+9
-6
@@ -5,15 +5,16 @@ import os
|
||||
from playwright.async_api import async_playwright
|
||||
from xhs import XhsClient
|
||||
|
||||
from conf import BASE_DIR
|
||||
from conf import BASE_DIR, LOCAL_CHROME_HEADLESS
|
||||
from utils.base_social_media import set_init_script
|
||||
from utils.log import tencent_logger, kuaishou_logger, douyin_logger
|
||||
from pathlib import Path
|
||||
from uploader.xhs_uploader.main import sign_local
|
||||
|
||||
|
||||
async def cookie_auth_douyin(account_file):
|
||||
async with async_playwright() as playwright:
|
||||
browser = await playwright.chromium.launch(headless=True)
|
||||
browser = await playwright.chromium.launch(headless=LOCAL_CHROME_HEADLESS)
|
||||
context = await browser.new_context(storage_state=account_file)
|
||||
context = await set_init_script(context)
|
||||
# 创建一个新的页面
|
||||
@@ -38,9 +39,10 @@ async def cookie_auth_douyin(account_file):
|
||||
await browser.close()
|
||||
return False
|
||||
|
||||
|
||||
async def cookie_auth_tencent(account_file):
|
||||
async with async_playwright() as playwright:
|
||||
browser = await playwright.chromium.launch(headless=True)
|
||||
browser = await playwright.chromium.launch(headless=LOCAL_CHROME_HEADLESS)
|
||||
context = await browser.new_context(storage_state=account_file)
|
||||
context = await set_init_script(context)
|
||||
# 创建一个新的页面
|
||||
@@ -55,9 +57,10 @@ async def cookie_auth_tencent(account_file):
|
||||
tencent_logger.success("[+] cookie 有效")
|
||||
return True
|
||||
|
||||
|
||||
async def cookie_auth_ks(account_file):
|
||||
async with async_playwright() as playwright:
|
||||
browser = await playwright.chromium.launch(headless=True)
|
||||
browser = await playwright.chromium.launch(headless=LOCAL_CHROME_HEADLESS)
|
||||
context = await browser.new_context(storage_state=account_file)
|
||||
context = await set_init_script(context)
|
||||
# 创建一个新的页面
|
||||
@@ -76,7 +79,7 @@ async def cookie_auth_ks(account_file):
|
||||
|
||||
async def cookie_auth_xhs(account_file):
|
||||
async with async_playwright() as playwright:
|
||||
browser = await playwright.chromium.launch(headless=True)
|
||||
browser = await playwright.chromium.launch(headless=LOCAL_CHROME_HEADLESS)
|
||||
context = await browser.new_context(storage_state=account_file)
|
||||
context = await set_init_script(context)
|
||||
# 创建一个新的页面
|
||||
@@ -99,7 +102,7 @@ async def cookie_auth_xhs(account_file):
|
||||
return True
|
||||
|
||||
|
||||
async def check_cookie(type,file_path):
|
||||
async def check_cookie(type, file_path):
|
||||
match type:
|
||||
# 小红书
|
||||
case 1:
|
||||
|
||||
Reference in New Issue
Block a user