mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-03-20 10:17:24 +08:00
fix: make SSL verification opt-in via config, extend fix to all platforms
- Add DISABLE_SSL_VERIFY = False to base_config.py (default: verification on) - Add tools/httpx_util.py with make_async_client() factory that reads the config - Replace all httpx.AsyncClient() call sites across all platforms (bilibili, weibo, zhihu, xhs, douyin, kuaishou) and crawler_util with make_async_client() - Extends SSL fix to previously missed platforms: xhs, douyin, kuaishou Users running behind an intercepting proxy can set DISABLE_SSL_VERIFY = True in config/base_config.py. All other users retain certificate verification. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,7 @@ from PIL import Image, ImageDraw, ImageShow
|
||||
from playwright.async_api import Cookie, Page
|
||||
|
||||
from . import utils
|
||||
from .httpx_util import make_async_client
|
||||
|
||||
|
||||
async def find_login_qrcode(page: Page, selector: str) -> str:
|
||||
@@ -47,7 +48,7 @@ async def find_login_qrcode(page: Page, selector: str) -> str:
|
||||
)
|
||||
login_qrcode_img = str(await elements.get_property("src")) # type: ignore
|
||||
if "http://" in login_qrcode_img or "https://" in login_qrcode_img:
|
||||
async with httpx.AsyncClient(follow_redirects=True, verify=False) as client:
|
||||
async with make_async_client(follow_redirects=True) as client:
|
||||
utils.logger.info(f"[find_login_qrcode] get qrcode by url:{login_qrcode_img}")
|
||||
resp = await client.get(login_qrcode_img, headers={"User-Agent": get_user_agent()})
|
||||
if resp.status_code == 200:
|
||||
|
||||
Reference in New Issue
Block a user