Added manga-py source
This commit is contained in:
18
manga-py-stable_1.x/manga_py/base_classes/cf_protect.py
Normal file
18
manga-py-stable_1.x/manga_py/base_classes/cf_protect.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from sys import stderr
|
||||
|
||||
import cloudscraper
|
||||
|
||||
|
||||
class CloudFlareProtect:
|
||||
protector = []
|
||||
|
||||
def run(self, url): # pragma: no cover
|
||||
|
||||
if not self.protector:
|
||||
scraper = cloudscraper.create_scraper()
|
||||
try:
|
||||
self.protector = scraper.get_tokens(url)
|
||||
except Exception as e:
|
||||
print('CF error! %s' % e, file=stderr)
|
||||
|
||||
return self.protector
|
||||
Reference in New Issue
Block a user