文章詳情頁
python - 用scrapy-splash爬取網站 為啥iframe下的內容沒有被返回
瀏覽:75日期:2022-08-10 09:23:22
問題描述
用scrapy-splash爬取網站 為啥iframe下的內容沒有被返回?
import scrapyfrom scrapy import Selectorclass Music163Spider(scrapy.Spider): name = 'music163' allowed_domains = ['music.163.com/#/discover/toplist'] start_urls = [’http://music.163.com/#/discover/toplist/’] def parse(self, response):print('parse:',response.text) def start_requests(self):for url in self.start_urls: yield scrapy.Request(url, self.parse, meta={’splash’: { ’endpoint’: ’render.html’, ’args’: {’wait’: 0.5, }} })
問題解答
回答1:你需要在parse中獲取iframe的url再次請求內容。
相關文章:
1. mysql優化 - mysql count(id)查詢速度如何優化?2. mysql主從 - 請教下mysql 主動-被動模式的雙主配置 和 主從配置在應用上有什么區別?3. angular.js - angularjs 用ng-reapt渲染的dom 怎么獲取上面的屬性4. 主從備份 - 跪求mysql 高可用主從方案5. css3 - [CSS] 動畫效果 3D翻轉bug6. node.js - node_moduls太多了7. angular.js - Angular路由和express路由的組合使用問題8. python如何不改動文件的情況下修改文件的 修改日期9. python - django 里自定義的 login 方法,如何使用 login_required()10. angular.js - 不適用其他構建工具,怎么搭建angular1項目
排行榜
![css3 - [CSS] 動畫效果 3D翻轉bug](http://www.aoyou183.cn/attached/image/news/202304/110831f073.png)