Files
py_facebook/test_playwright_share.py
work db8326f5be
All checks were successful
Update Code / StopService (windows-101.36.102.136) (push) Successful in 1s
Update Code / StopService (windows-101.36.104.175) (push) Successful in 1s
Update Code / CD (windows-101.36.102.136) (push) Successful in 11s
Update Code / CD (windows-101.36.104.175) (push) Successful in 25s
转发灰度页面也能正常执行
2026-04-14 14:40:34 +08:00

50 lines
2.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import json
from loguru import logger
import spider.task as task_module
# 直接在这里填写测试参数
# COOKIES = {"c_user":"61587192741710","datr":"DD6YadZiGvjrWPeJsziYcVps","fr":"0Vx730xAppd88aMk6.AWeUeOUnFJ0z10NPAXdxjLalRp5PMdn5gCwulJ5AIgWCvqh4B0Y.BpmD7b..AAA.0.0.BpmD7b.AWf3LOz6RaIIheJztf4K8-0urhQ","xs":"17:X737_mFveQOCjg:2:1771585246:-1:-1"}
# COOKIES = {"c_user":"61574261924177","datr":"b93aaSfufy7KSzEBmShfLqJY","fr":"07L77tEMETzACXCvv.AWf_o6-uoxdbOQ8QiEmrVt5bIP2gVfdf4e3R0w4Eg205Eg0xsms.Bp2t3j..AAA.0.0.Bp2t3j.AWcrnpRZr2VJOMU94nUAXFmq2x8","xs":"44:yPtMHPoNucdZCg:2:1775951339:-1:-1"}
# COOKIES = {"c_user":"61570694932587","datr":"P1graE1OpoAazqfOOl-bX3Fu","oo":"v13:1776064962","xs":"33:nSmF-tHC6p4SOg:2:1776064969:-1:-1"}
# COOKIES = {"c_user":"61573351360189","datr":"Jd7aadJGfdlqf2PaC8Esc_Ty","oo":"v13:1775951530","xs":"19:bv_rfhwfD3PX0w:2:1775951539:-1:-1"}
# COOKIES = {"c_user":"61572352414179","datr":"cXnaaXLZcbL6cXIejDKcUarc","oo":"v13:1775925753","xs":"34:-eVFsriAzPFVVQ:2:1775925759:-1:-1"}
COOKIES = {"c_user":"61572977825069","datr":"ALXaaW5Q-bJ7_gQWTjU-Qosd","oo":"v13:1775940979","xs":"16:A9ieAMX5SjNUBQ:2:1775940983:-1:-1"}
TARGET_URL = "https://www.facebook.com/permalink.php?story_fbid=pfbid026dQik7NyujSGd2rjWyTKbQVw2CVM5BeJEP9sYxo7K5TBGhWZ4sUfs4gMoSLKq2mJl&id=61575372223339"
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()