diff options
| author | 2023-06-19 01:14:28 -0400 | |
|---|---|---|
| committer | 2023-06-19 01:14:28 -0400 | |
| commit | 9fb906aeb3816abb42f459d1b67e35024e6f2348 (patch) | |
| tree | 30b039301c783475c0f4d46b0e0c5ec9851b2567 /gallery_dl/extractor/pornhub.py | |
| parent | 8950c0f2ef55ec2ed36b3fccc9fd85b64b877c3b (diff) | |
New upstream version 1.25.6.upstream/1.25.6
Diffstat (limited to 'gallery_dl/extractor/pornhub.py')
| -rw-r--r-- | gallery_dl/extractor/pornhub.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gallery_dl/extractor/pornhub.py b/gallery_dl/extractor/pornhub.py index f8497c0..f19e33c 100644 --- a/gallery_dl/extractor/pornhub.py +++ b/gallery_dl/extractor/pornhub.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019-2021 Mike Fährmann +# Copyright 2019-2023 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -11,7 +11,6 @@ from .common import Extractor, Message from .. import text, exception - BASE_PATTERN = r"(?:https?://)?(?:[\w-]+\.)?pornhub\.com" @@ -146,10 +145,20 @@ class PornhubUserExtractor(PornhubExtractor): data = {"_extractor": PornhubGalleryExtractor} while True: - page = self.request( - url, method="POST", headers=headers, params=params).text - if not page: - return - for gid in text.extract_iter(page, 'id="albumphoto', '"'): + response = self.request( + url, method="POST", headers=headers, params=params, + allow_redirects=False) + + if 300 <= response.status_code < 400: + url = "{}{}/photos/{}/ajax".format( + self.root, response.headers["location"], + self.cat or "public") + continue + + gid = None + for gid in text.extract_iter(response.text, 'id="albumphoto', '"'): yield Message.Queue, self.root + "/album/" + gid, data + if gid is None: + return + params["page"] += 1 |
