Anorov / cloudflare-scrape

A Python module to bypass Cloudflare's anti-bot page.
MIT License
3.38k stars 459 forks source link

403 error when loading a web page #417

Closed Quessts closed 3 years ago

Quessts commented 3 years ago

Before creating an issue, first upgrade cfscrape with pip install -U cfscrape and see if you're still experiencing the problem. Please also confirm your Node version (node --version or nodejs --version) is version 10 or higher.

Make sure the website you're having issues with is actually using anti-bot protection by Cloudflare and not a competitor like Imperva Incapsula or Sucuri. And if you're using an anonymizing proxy, a VPN, or Tor, Cloudflare often flags those IPs and may block you or present you with a captcha as a result.

Please confirm the following statements and check the boxes before creating an issue:

Python version number

Run python --version and paste the output below:

3.7.9

cfscrape version number

Run pip show cfscrape and paste the output below:

2.1.1

Code snippet involved with the issue

import cfscrape

s = cfscrape.create_scraper()
headers = {
    'authorization': 'discord token',
    'Content-Type': 'application/json',
    'user-agent': 'user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'
}

json = {
    'content': 'message'
}

r = s.post('https://discordapp.com/api/v6/channels/597890559423807519/messages',
           headers=headers, json=json)
print(r.status_code)
print(r.content)

URL of the Cloudflare-protected page

https://discordapp.com/api/v6/channels/597890559423807519/messages

URL of Pastebin/Gist with HTML source of protected page

https://pastebin.com/nVN6vQSp

Quessts commented 3 years ago

in 'user-agent': 'user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36' I had 'user-agent" written down twice. My bad! closing this issue now