2

I was making a request to the following API URL but getting a <403> response.

Click here to open the API Link

The link works fine when opening with the browser. I opened the scrapy response in the browser and saw that it's showing a captcha. How can I bypass the captcha and make a request like a real human with scrapy or request?

# -*- coding: utf-8 -*-
import scrapy
import json

class MainSpider(scrapy.Spider):
    name = 'main'
    start_urls = ['https://www.mediamarkt.de/api/v1/graphql?operationName=CategoryV3&variables={%22hasMarketplace%22%3Atrue%2C%22wcsId%22%3A%22459521%22%2C%22page%22%3A1%2C%22experiment%22%3A%22mp%22}&extensions={%22pwa%22%3A{%22salesLine%22%3A%22Media%22%2C%22country%22%3A%22DE%22%2C%22language%22%3A%22de%22}%2C%22persistedQuery%22%3A{%22version%22%3A1%2C%22sha256Hash%22%3A%2211d83e8b68f9a2a73adc1cf50dd17b1dffcc99dc9636285bfc42088860610b05%22}}']

    def parse(self, response):
        resp = json.loads(response.body)
        values = resp.get('data').get('products')

        print(values)

enter image description here

codewithawais
  • 551
  • 1
  • 6
  • 25

0 Answers0