代码报错00py13 DeprecationWarning headless property is deprecated instead use add_argument--headless or add_argument--headless=new optionsheadless = TrueTraceback most recent call last File 00py line 21
代码中的错误是语法错误,具体来说是在读取cookie文件时,所读取的字符串格式不正确,导致在eval函数中出现了语法错误。
建议将cookie文件的内容以字典的形式保存,例如:
{ "_gid": "GA1.2.521438284.1685852601", "login": "srtzimu", "xfss": "qysa23rf7bfqme45", "_ga": "GA1.1.607076236.1685852601", "overlay": "true", "bcs_cookie_live_stream": "1", "overlay_count": "14", "index_ut": "html5", "_ga_RCR9PNF6FL": "GS1.1.1685955589.9.1.1685958086.0.0.0" }
然后在读取cookie文件时,使用json模块进行解析,例如:
import json
with open(cookie_file, "r") as f: cookies = json.load(f)
这样可以保证读取到的cookie数据格式正确,避免eval函数出现语法错误
原文地址: https://www.cveoy.top/t/topic/fXIn 著作权归作者所有。请勿转载和采集!