diff options
| author | 2024-01-23 23:35:00 -0500 | |
|---|---|---|
| committer | 2024-01-23 23:35:00 -0500 | |
| commit | 12e23f1195164dcb740d6d4a4287e762c9e5e534 (patch) | |
| tree | e6b13483475c510ea2f685c21363271f23745c56 /gallery_dl/extractor/patreon.py | |
| parent | e949aaf6f6ac93896947d5b736e48e7911926efb (diff) | |
New upstream version 1.26.7.upstream/1.26.7
Diffstat (limited to 'gallery_dl/extractor/patreon.py')
| -rw-r--r-- | gallery_dl/extractor/patreon.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gallery_dl/extractor/patreon.py b/gallery_dl/extractor/patreon.py index 6c2f39d..62d11f2 100644 --- a/gallery_dl/extractor/patreon.py +++ b/gallery_dl/extractor/patreon.py @@ -52,19 +52,29 @@ class PatreonExtractor(Extractor): post["hash"] = fhash post["type"] = kind post["num"] += 1 - yield Message.Url, url, text.nameext_from_url(name, post) + text.nameext_from_url(name, post) + if text.ext_from_url(url) == "m3u8": + url = "ytdl:" + url + post["extension"] = "mp4" + yield Message.Url, url, post else: self.log.debug("skipping %s (%s %s)", url, fhash, kind) - @staticmethod - def _postfile(post): + def _postfile(self, post): postfile = post.get("post_file") if postfile: - return (("postfile", postfile["url"], postfile["name"]),) + url = postfile["url"] + name = postfile.get("name") + if not name: + if url.startswith("https://stream.mux.com/"): + name = url + else: + name = self._filename(url) or url + return (("postfile", url, name),) return () def _images(self, post): - for image in post["images"]: + for image in post.get("images") or (): url = image.get("download_url") if url: name = image.get("file_name") or self._filename(url) or url @@ -80,7 +90,7 @@ class PatreonExtractor(Extractor): return () def _attachments(self, post): - for attachment in post["attachments"]: + for attachment in post.get("attachments") or (): url = self.request( attachment["url"], method="HEAD", allow_redirects=False, fatal=False, |
