goopypanther / saucebot-discord

17 stars 13 forks source link

Need cloudflare-scrape to access FurAffinity #3

Closed minddrive closed 4 years ago

minddrive commented 6 years ago

A recent DDOS against FurAffinity caused them to turn on Cloudflare's anti-spam service, which prevents the program from accessing FA successfully. However, a Python module was released named cfscrape ( https://github.com/Anorov/cloudflare-scrape ). This allows non-browsers to be able to work around the anti-spam server and restores functionality for FA.

I do have a patch for this, but sadly I'm in the middle of a refactor and the code is somewhat different, but the basic steps are:

1) Install node.js (needed by cfscrape) 2) Install cfscrape via pip 3) Add the following lines to the code:

    import cfscrape

    scraper = cfscrape.create_scraper()

and replace at the very least the FA requests.get() call with scraper.get()

This should fix the issue (and tested successfully on a currently running bot on Discord).

One thing to note: Cloudflare updates it's anti-spam mechanism every so often, so the cfscrape module will be updated to match it on a regular basis.