修复转发
All checks were successful
Update Code / StopService (windows-101.36.104.175) (push) Successful in 0s
Update Code / StopService (windows-101.36.102.136) (push) Successful in 0s
Update Code / CD (windows-101.36.102.136) (push) Successful in 8s
Update Code / CD (windows-101.36.104.175) (push) Successful in 12s

This commit is contained in:
work
2026-04-10 22:34:55 +08:00
parent 3dc74b6ad2
commit faae5d3ba8
2 changed files with 248 additions and 66 deletions

43
test_playwright_share.py Normal file
View File

@@ -0,0 +1,43 @@
import json
from loguru import logger
import spider.task as task_module
# 直接在这里填写测试参数
COOKIES = {"c_user":"61588267419224","datr":"3D2XaYqWJ1w9rJU6X6e02or_","fr":"0k8G2UtA1NqMJqD0s.AWemansED9s7o5tmbiUwA7gqAoWOk99OEJw8_zCrRks9IgULoSk.Bplz6g..AAA.0.0.Bplz6g.AWfaScT_l9g4id9lBpHtDtHo-T4","xs":"28:izkUxLXyFn_-OA:2:1771519655:-1:-1"}
TARGET_URL = "https://www.facebook.com/permalink.php?story_fbid=pfbid023QsxMBw26HAdt3LW1Ln7GUugWYbQkzfL9Ws68XUiuaXJvFD3u1iKtVFq7hpypdFtl&id=61580561183111"
CONTENT = "Youve earned my admiration with this quality."
def _validate_config():
missing = [key for key, value in COOKIES.items() if not str(value).strip()]
if missing:
raise ValueError(f"cookies 缺少字段: {', '.join(missing)}")
if not TARGET_URL.strip():
raise ValueError("TARGET_URL 不能为空")
if "facebook.com" not in TARGET_URL:
raise ValueError(f"TARGET_URL 不是有效的 Facebook 链接: {TARGET_URL}")
def main():
_validate_config()
logger.add("./log/test_playwright_share.log", rotation="20 MB")
result = task_module.playwright_share(
cookies=COOKIES,
target_url=TARGET_URL,
content=CONTENT,
)
logger.info("转发结果: {}", result)
print(json.dumps(result, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()