# 依赖及版本(请自行选择)
scrapy==2.11.0
lxml==5.0.0
pyOpenSSL==23.3.0
# 修改请求头,防止被目标服务器阻止
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
# False即不遵循robots协议,爬取该网站不允许的URL,否则可能会无法爬取数据
ROBOTSTXT_OBEY = False
解决方法:
# 找到旧代码
from ._lzma import *
from ._lzma import _encode_filter_properties, _decode_filter_properties
# 改为新代码
try:
from ._lzma import *
from ._lzma import _encode_filter_properties, _decode_filter_properties
except ImportError:
from backports.lzma import *
from backports.lzma import _encode_filter_properties, _decode_filter_properties