add playwright && remove feapder

This commit is contained in:
jxxghp 2023-06-09 17:22:26 +08:00
parent 71ceb4c186
commit edac5b1927
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
from playwright.sync_api import sync_playwright from playwright.sync_api import sync_playwright
class PlaywrightUtils: class PlaywrightHelper:
def __init__(self, browser_type="chromium"): def __init__(self, browser_type="chromium"):
self.browser_type = browser_type self.browser_type = browser_type
@ -34,7 +34,7 @@ class PlaywrightUtils:
# 示例用法 # 示例用法
if __name__ == "__main__": if __name__ == "__main__":
utils = PlaywrightUtils() utils = PlaywrightHelper()
test_url = "https://www.baidu.com" test_url = "https://www.baidu.com"
test_cookies = "cookie1=value1; cookie2=value2" test_cookies = "cookie1=value1; cookie2=value2"
test_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36" test_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"

View File

@ -9,8 +9,8 @@ from pyquery import PyQuery
from ruamel.yaml import CommentedMap from ruamel.yaml import CommentedMap
from app.core import settings from app.core import settings
from app.helper.playwright import PlaywrightHelper
from app.log import logger from app.log import logger
from app.modules.indexer.playwright_utils import PlaywrightUtils
from app.utils.http import RequestUtils from app.utils.http import RequestUtils
from app.utils.string import StringUtils from app.utils.string import StringUtils
from app.utils.types import MediaType from app.utils.types import MediaType
@ -215,7 +215,7 @@ class TorrentSpider:
logger.info(f"开始请求:{searchurl}") logger.info(f"开始请求:{searchurl}")
if self.render: if self.render:
page_source = PlaywrightUtils().get_page_source( page_source = PlaywrightHelper().get_page_source(
url=searchurl, url=searchurl,
cookie=self.cookie, cookie=self.cookie,
ua=self.ua, ua=self.ua,