diff options
| author | 2019-12-25 19:40:28 -0500 | |
|---|---|---|
| committer | 2019-12-25 19:40:28 -0500 | |
| commit | f9a1a9dcb7df977eeac9544786df9c0b93795815 (patch) | |
| tree | 8cb69cf7685da8d7e4deb7dc1d6b209098e1ddfb /gallery_dl/extractor/bobx.py | |
| parent | 0c73e982fa596da07f23b377621ab894a9e64884 (diff) | |
New upstream version 1.12.1upstream/1.12.1
Diffstat (limited to 'gallery_dl/extractor/bobx.py')
| -rw-r--r-- | gallery_dl/extractor/bobx.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gallery_dl/extractor/bobx.py b/gallery_dl/extractor/bobx.py index dba5fe7..94a2840 100644 --- a/gallery_dl/extractor/bobx.py +++ b/gallery_dl/extractor/bobx.py @@ -10,18 +10,38 @@ from .common import Extractor, Message from .. import text +from ..cache import memcache +import random +import time class BobxExtractor(Extractor): """Base class for bobx extractors""" category = "bobx" root = "http://www.bobx.com" + cookiedomain = ".bobx.com" per_page = 80 def __init__(self, match): Extractor.__init__(self, match) self.path = match.group(1) + def login(self): + if not self._check_cookies(("BobXUser",)): + self._update_cookies(self._login_impl()) + + @memcache() + def _login_impl(self): + """Generate a randomized 'BobXUser' cookie""" + rand = random.randrange + tnow = time.time() - rand(60, 3600) + + return {"BobXUser": "{}.{}.{}.{}.{}.{}".format( + int(tnow), + rand(128, 192), rand(0, 256), rand(0, 256), rand(0, 256), + tnow + 622080000, # timestamp in 7200 days + )} + class BobxGalleryExtractor(BobxExtractor): """Extractor for individual image galleries on bobx.com""" @@ -46,6 +66,8 @@ class BobxGalleryExtractor(BobxExtractor): ) def items(self): + self.login() + num = 0 while True: url = "{}/{}-{}-10-8.html".format(self.root, self.path, num) @@ -99,6 +121,7 @@ class BobxIdolExtractor(BobxExtractor): }) def items(self): + self.login() url = "{}/{}/".format(self.root, self.path) data = {"_extractor": BobxGalleryExtractor} page = self.request(url).text |
