File "C:\python\Lib\site-packages\scrapy_splash\middleware.py", line 19, in <module>
from scrapy_splash.responsetypes import responsetypes
File "C:\python\Lib\site-packages\scrapy_splash\responsetypes.py", line 41, in <module>
responsetypes = SplashResponseTypes()
File "C:\python\Lib\site-packages\scrapy\responsetypes.py", line 49, in __init__
self.classes[mimetype] = load_object(cls)
~~~~~~~~~~~^^^^^
File "C:\python\Lib\site-packages\scrapy\utils\misc.py", line 71, in load_object
mod = import_module(module)
File "C:\python\Lib\importlib\__init__.py", line 88, in import_module
return _bootstrap._**_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\scrapy_splash\response.py", line 11, in <module>
from scrapy_splash.utils import headers_to_scrapy
File "C:\python\Lib\site-packages\scrapy_splash\utils.py", line 12, in <module>
from scrapy.utils.python import unicode_to_str as to_bytes
ImportError: cannot import name 'unicode_to_str' from 'scrapy.utils.python' (C:\python\Lib\site-packages\scrapy\utils\python.py)
while(true)
do
splash:runjs("document.getElementsByClassName('load_more_btn')[0].scrollIntoView(true)")
splash:select(".load_more_btn").click()
splash:wait(1)
--判断load_more_btn是否是none
display = get_btn_display()
if(display == 'none')
then
break
end
更新后
Requirement already satisfied: scrapy_splash in c:\python\lib\site-packages (0.9.0)
然后运行程序还是报错下面
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\python\Scripts\scrapy.exe\__main__.py", line 7, in <module>
sys.exit(execute())
~~~~~~~^^
File "C:\python\Lib\site-packages\scrapy\cmdline.py", line 187, in execute
cmd.crawler_process = CrawlerProcess(settings)
~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\python\Lib\site-packages\scrapy\crawler.py", line 424, in __init__
super().__init__(settings)
~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\python\Lib\site-packages\scrapy\crawler.py", line 295, in __init__
self.spider_loader: SpiderLoader = self._get_spider_loader(settings)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "C:\python\Lib\site-packages\scrapy\crawler.py", line 289, in _get_spider_loader
return cast("SpiderLoader", loader_cls.from_settings(settings.frozencopy()))
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\scrapy\spiderloader.py", line 81, in from_settings
return cls(settings)
File "C:\python\Lib\site-packages\scrapy\spiderloader.py", line 36, in __init__
self._load_all_spiders()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\python\Lib\site-packages\scrapy\spiderloader.py", line 65, in _load_all_spiders
for module in walk_modules(name):
~~~~~~~~~~~~^^^^^^
File "C:\python\Lib\site-packages\scrapy\utils\misc.py", line 98, in walk_modules
submod = import_module(fullpath)
File "C:\python\Lib\importlib\__init__.py", line 88, in import_module
return _bootstrap._**_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _**_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "C:\pythonbase\news\news\spiders\wangyi.py", line 5, in <module>
from scrapy_splash.request import SplashRequest
File "C:\python\Lib\site-packages\scrapy_splash\__init__.py", line 10, in <module>
from .dupefilter import SplashAwareDupeFilter, splash_request_fingerprint
File "C:\python\Lib\site-packages\scrapy_splash\dupefilter.py", line 12, in <module>
from scrapy.utils.request import request_fingerprint
ImportError: cannot import name 'request_fingerprint' from 'scrapy.utils.request' (C:\python\Lib\site-packages\scrapy\utils\request.py)作者: Five66 时间: 4 天前 00:15