Scrape with Splash Requests returns empty

Viewed 44

I am trying to scrape a cooking site, but in vain. I have done it with selenium but is a bit slow. So I am trying with scrapy, but it returns always empty strings I have also modified the settings.py from according to steps 1-5 from https://github.com/scrapy-plugins/scrapy-splash

import scrapy
from scrapy_splash import SplashRequest

class CookingSpider(scrapy.Spider):
    name = 'cooking'
    def start_requests(self):
        url = 'https://akispetretzikis.com/en/recipe/6641/patates-twn-15-wrwn'
        headers = {
            ":authority": "akispetretzikis.com",
            "accept": "image / avif, image / webp, image / apng, image / svg + xml, image / *, * / *;q = 0.8",
            "Accept-Encoding": "gzip, deflate, br",
            "Accept-Language": "en-GB,en;q=0.9,el-GR;q=0.8,el;q=0.7,en-US;q=0.6",
            "referer": "https://akispetretzikis.com/_next/static/css/6d2cea28911cae6f.css",
            "sec-ch-ua-mobile": "?0",
            "Cache-Control": "no-cache",
            "sec-ch-ua-platform": "Linux",
            "sec-fetch-dest": "image",
            "sec-fetch-mode": "no-cors",
            "sec-fetch-site": "same - origin",
            'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'}
        yield SplashRequest(url=url, headers=headers,  args={"wait": 10},callback=self.parse)

    def parse(self, response):

        yield {
            "name": response.xpath('//div[@class="text-center"]/text()').extract()
        }

thank you

0 Answers
Related