I successfully parse the main of the website but the callback doesn't call second function, so i am not getting iframe's data. The website is https://www.farfeshplus.com/Video.asp?ZoneID=297
The spider code is as follow:
# -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class YuSpider(CrawlSpider):
name = 'yu'
allowed_domains = ['farfeshplus.com']
start_urls = ['https://www.farfeshplus.com/Video.asp?ZoneID=297']
rules = (
Rule(LinkExtractor(restrict_xpaths='//td[@class="text6"]'), callback='parse_item', follow=True),
)
def parse_item(self, response):
for url in response.xpath('//html'):
yield {
'NAME': url.xpath('//h1/div/text()').extract(),
}
frames = url.xpath('//iframe[@width="750"]/@src').extract_first()
yield scrapy.Request(url=frames, callback=self.parse_frame)
def parse_frame(self, response):
for f in response.xpath('//div[@class="rmp-content"]/video'):
yield {
'URL': f.xpath('//div[@class="rmp-content"]/video/@src').extract(),
}
Tried changing the name of parse_item to parse_start_url but no luck.