python - 用scrapy-splash爬取网站 为啥iframe下的内容没有被返回
巴扎黑
巴扎黑 2017-04-18 10:31:05
0
1
1484

用scrapy-splash爬取网站 为啥iframe下的内容没有被返回?

import scrapy
from scrapy import Selector



class 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,
                    }
                }
            })
巴扎黑
巴扎黑

reply all(1)
大家讲道理

You need to get the url of the iframe in parse to request the content again.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template