john1986
发表于 2022-10-22 17:14:42
优秀
john1986
发表于 2022-10-23 05:49:37
请教一下,我将作者的原代码直接复制过来可是没有跑通,出现了下面的问题提醒,不知道各位伙伴知道问题出在哪里不?
E:\python练习\PyCharm相关练习_operation\venv\Scripts\python.exe E:\python练习\PyCharm相关练习_operation\venv\test.py
开始爬第1页
Traceback (most recent call last):
File "E:\python练习\PyCharm相关练习_operation\venv\test.py", line 104, in <module>
spider_tx()
File "E:\python练习\PyCharm相关练习_operation\venv\test.py", line 99, in spider_tx
find_videos(url)
File "E:\python练习\PyCharm相关练习_operation\venv\test.py", line 19, in find_videos
for each in soup.select('."list_item"'):
File "E:\python练习\PyCharm相关练习_operation\venv\lib\site-packages\bs4\element.py", line 1973, in select
results = soupsieve.select(selector, self, namespaces, limit, **kwargs)
File "E:\python练习\PyCharm相关练习_operation\venv\lib\site-packages\soupsieve\__init__.py", line 144, in select
return compile(select, namespaces, flags, **kwargs).select(tag, limit)
File "E:\python练习\PyCharm相关练习_operation\venv\lib\site-packages\soupsieve\__init__.py", line 67, in compile
return cp._cached_css_compile(pattern, ns, cs, flags)
File "E:\python练习\PyCharm相关练习_operation\venv\lib\site-packages\soupsieve\css_parser.py", line 221, in _cached_css_compile
flags=flags
File "E:\python练习\PyCharm相关练习_operation\venv\lib\site-packages\soupsieve\css_parser.py", line 1159, in process_selectors
return self.parse_selectors(self.selector_iter(self.pattern), index, flags)
File "E:\python练习\PyCharm相关练习_operation\venv\lib\site-packages\soupsieve\css_parser.py", line 985, in parse_selectors
key, m = next(iselector)
File "E:\python练习\PyCharm相关练习_operation\venv\lib\site-packages\soupsieve\css_parser.py", line 1152, in selector_iter
raise SelectorSyntaxError(msg, self.pattern, index)
soupsieve.util.SelectorSyntaxError: Malformed class selector at position 0
line 1:
."list_item"
^
进程已结束,退出代码1
q304010063
发表于 2022-10-23 17:29:53
qe
L456134
发表于 2023-4-2 10:04:29
竟如此优秀
132013213
发表于 2023-4-2 13:15:51
强
1211532034
发表于 2023-5-8 22:20:02
666
maikehong
发表于 2024-4-5 17:30:56
本帖最后由 maikehong 于 2024-4-5 17:39 编辑
我怎么报错了?错误信息
开始爬第1页
Traceback (most recent call last):
File "D:\工具\py项目\py测试\腾讯视频的html.py", line 104, in <module>
spider_tx()
File "D:\工具\py项目\py测试\腾讯视频的html.py", line 99, in spider_tx
find_videos(url)
File "D:\工具\py项目\py测试\腾讯视频的html.py", line 19, in find_videos
for each in soup.select('."list_item"'):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\bs4\element.py", line 2116, in select
return self.css.select(selector, namespaces, limit, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\bs4\css.py", line 162, in select
self.api.select(
File "C:\Program Files\Python312\Lib\site-packages\soupsieve\__init__.py", line 147, in select
return compile(select, namespaces, flags, **kwargs).select(tag, limit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\soupsieve\__init__.py", line 65, in compile
return cp._cached_css_compile(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\soupsieve\css_parser.py", line 208, in _cached_css_compile
).process_selectors(),
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\soupsieve\css_parser.py", line 1129, in process_selectors
return self.parse_selectors(self.selector_iter(self.pattern), index, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\soupsieve\css_parser.py", line 965, in parse_selectors
key, m = next(iselector)
^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\soupsieve\css_parser.py", line 1122, in selector_iter
raise SelectorSyntaxError(msg, self.pattern, index)
soupsieve.util.SelectorSyntaxError: Malformed class selector at position 0
line 1:
."list_item"
^
ch722519
发表于 2024-8-29 11:25:09
Benluck
发表于 2024-8-29 20:12:50
学习一下
凤梨7723
发表于 2024-11-21 02:53:27
·
Hmc123
发表于 2024-12-6 16:29:06
瞅瞅
小明ys
发表于 2024-12-8 02:53:30
6
lindada910
发表于 2024-12-9 16:57:35
学习了解+1
online
发表于 2024-12-11 10:34:01
{:5_101:}
肥肥红绿灯
发表于 2024-12-11 10:46:45
学习一下
矢量比特
发表于 2024-12-11 13:27:28
11111111
qq7881575
发表于 2024-12-12 09:05:23
66666666666666666
叫花儿
发表于 2024-12-12 10:05:57
感谢无私分享!在网上找了好久相关资料,都没有找到
tysxsy
发表于 2024-12-13 17:47:23
{:10_243:}
PAMIS
发表于 6 天前
好呀