问题
I have tried many solutions but I am unable to scrape images with Scrapy. Can Someone can teach me how to scrape images using Scrapy?
Here is my complete code.
Spider:
import scrapy
import datetime
from ..items import ImagesItem
class image(scrapy.Spider):
name = 'img'
start_urls = [
'https://www.allhindilyrics.com/lyrics/nachan-nu-jee-karda-from-angrezi-medium'
]
def parse(self, response):
items = ImagesItem()
image_url = response.xpath('//*[@id="polular"]/div[1]/div/div/div/a/img').extract()
items['image_urls'] = image_url
return items
My items.py
:
import scrapy
class ImagesItem(scrapy.Item):
image_urls = scrapy.Field()
images = scrapy.Field()
I have also enabled a pipeline with file storage. Please help me with this as I am new to Python and I really need help.
来源:https://stackoverflow.com/questions/60580141/how-do-you-scrape-images-with-scrapy