文章詳情頁
python - 用scrapy-splash爬取網站 為啥iframe下的內容沒有被返回
瀏覽:116日期: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. javascript - 數組原聲方法中的一段代碼2. javascript - JS設置Video視頻對象的currentTime時出現了問題,IE,Edge,火狐,都可以設置,反而chrom卻...3. github - 利用Python 自動化部署問題4. 求大神幫我看看是哪里寫錯了 感謝細心解答5. objective-c - iOS怎么實現像QQ或者微信的實時推送6. 網頁爬蟲 - python爬蟲翻頁問題,請問各位大神我這段代碼怎樣翻頁,還有價格要登陸后才能看到,應該怎么解決7. python - from ..xxxx import xxxx到底是什么意思呢?8. php自學從哪里開始?9. phpstady在win10上運行10. 數據庫 - MySQL 單表500W+數據,查詢超時,如何優化呢?
排行榜
