私はこのサイトから曲の名前を取得しようとしていますhttps://pagalworld.me/category/11598/Latest%20Bollywood%20Hindi%20Mp3%20Songs%20-%202017.htmlリンク抽出機能を使用していますが、結果は繰り返しています。治療の結果が繰り返されます
import scrapy
from scrapy import Request
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class RedditSpider(CrawlSpider):
name='pagalworld'
allowed_domains = ["pagalworld.me"]
start_urls=['https://pagalworld.me/category/11598/Latest%20Bollywood%20Hindi%20Mp3%20Songs%20-%202017.html']
rules = (
Rule(
LinkExtractor(restrict_xpaths='//div/ul'),
follow=True,
callback='parse_start_url'),
)
def parse_start_url(self, response):
songName= response.xpath('//li/b/a/text()').extract()
for item in songName:
yield {"songName":item,
"URL":resposne}
出力と、完全なコード(異議の具体例も含む)を投稿してください。 – TrakJohnson