我代码可以获取到页面信息,但 li 里面的序号啊,描述啊都无法获取
结果如下:
2019-06-28 18:43:50 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://movie.douban.com/top250> (referer: None)
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
2019-06-28 18:43:50 [scrapy.core.engine] INFO: Closing spider (finished)
这个报错始终无法解决
我也遇到同样的问题,输出都是None
大壮老师救救我?
难道是因为红框这里没有爬到数据??
后面的输出序号的结果:
2019-06-28 18:54:05 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://movie.douban.com/top250> (referer: None)
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
<Selector xpath="//div[@class='article']//ol[@class='grid_view']//li" data='<li>\n <div class="item">\n '>
==============================================================
{'serial_number': None}
2019-06-28 18:54:05 [scrapy.core.engine] INFO: Closing spider (finished)
这里的“=====”是我自己为了方便查看print()的,不影响结果,序号的输出都是None,没辙了