-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
import logging | ||
import threading | ||
import time | ||
|
||
from selenium import webdriver | ||
from selenium.webdriver.support.ui import WebDriverWait | ||
|
||
|
||
class WebUtil: | ||
def __init__(self, cookie_dict): | ||
self.initialized_event = threading.Event() | ||
|
||
initialization_thread = threading.Thread(target=self.initialize, args=(cookie_dict,)) | ||
initialization_thread.start() | ||
|
||
def initialize(self, cookie_dict): | ||
self.driver = webdriver.Edge() | ||
self.driver.get("https://show.bilibili.com/platform/home.html") | ||
|
||
for cookie in cookie_dict["bilibili_cookies"]: | ||
self.driver.add_cookie(cookie) | ||
self.driver.refresh() | ||
self.wait = WebDriverWait(self.driver, 0.5) | ||
self.initialized_event.set() |