我試圖使用鏈接提取從本網站https://pagalworld.me/category/11598/Latest%20Bollywood%20Hindi%20Mp3%20Songs%20-%202017.html獲取歌曲的名稱,但結果是重複的。Scrapy結果重複
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