pavlodvornikov / aiocfscrape

A simple async Python module to bypass Cloudflare\'s anti-bot page. Based on aiohttp ClientSession.
MIT License
74 stars 21 forks source link

some help #28

Closed Cosmysd closed 3 years ago

Cosmysd commented 3 years ago

hello sir @Nachtalb how can use this lib to bypass uam? here is a exemple of my ytraffic generator based cfscrape, how can improve using your lib? thank.


def traffic():
    pprr = open(list).readlines()
    proxy = random.choice(pprr).strip().split(":")
    scraper = cfscrape.create_scraper()
    scraper.proxies = {
    'http' : 'http://{}:{}'.format(proxy[0], proxy[1]),
    'https' : 'https://{}:{}'.format(proxy[0], proxy[1])
    }
    while True:
        while oo:
            try:
                scraper.get(uri)
                print(Fore.CYAN + "Traffic Generated" + Fore.WHITE + str(uri)+ Fore.CYAN + " Using Porxy " +Fore.WHITE+ str(proxy[0])+":"+str(proxy[1]))
                try:
                    for g in range(per):
                        scraper.get(uri)
                        print(Fore.CYAN + "Traffic Generated" + Fore.WHITE + str(uri)+Fore.CYAN + " Using Porxy " +Fore.WHITE + str(proxy[0])+":"+str(proxy[1]))
                    scraper.close()
                except:
                    scraper.close()
            except:
                scraper.close()
                print(Fore.RED + "Can't Connect To Proxies Or Url !")```
Nachtalb commented 3 years ago

Cloudflare has changed it's challenge ATM this package won't work. We will have to rewrite it. You can find more information about that here: #27

Cosmysd commented 3 years ago

Cloudflare has changed it's challenge ATM this package won't work. We will have to rewrite it. You can find more information about that here: #27

What do you think about this that you think might be imported to work with your library? https://github.com/devgianlu/cloudflare-bypass ? or maybe a method using selenium, chromedriver, etc. to generate a real session and get cookies?

Nachtalb commented 3 years ago

I think using selenium with any driver is overkill and may just work for a temporary workaround. It's way to slow and would defeat the purpose of using async (selenium is blocking). If we'd go with a web driver it'd be something like this https://github.com/HDE/arsenic.

https://github.com/devgianlu/cloudflare-bypass, as you said, may just be the thing we want. We can run system commands asynchronously and we don't have to launch a whole browser. Though from a quick look it doesn't have a CLI and maybe we'd need to reimplement his work in python.