1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 04:02:32 +01:00

[patreon] extract 'attachments_media' files (#6241)

https://github.com/mikf/gallery-dl/issues/6241#issuecomment-2386343160
This commit is contained in:
Mike Fährmann 2024-10-01 19:41:26 +02:00
parent b03ee3c4c4
commit fb6be2dd34
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 22 additions and 2 deletions

View File

@ -100,6 +100,11 @@ class PatreonExtractor(Extractor):
if url: if url:
yield "attachment", url, attachment["name"] yield "attachment", url, attachment["name"]
for attachment in post.get("attachments_media") or ():
url = attachment.get("download_url")
if url:
yield "attachment", url, attachment["file_name"]
def _content(self, post): def _content(self, post):
content = post.get("content") content = post.get("content")
if content: if content:
@ -138,8 +143,12 @@ class PatreonExtractor(Extractor):
if attr.get("current_user_can_view", True): if attr.get("current_user_can_view", True):
relationships = post["relationships"] relationships = post["relationships"]
attr["images"] = self._files(post, included, "images") attr["images"] = self._files(
attr["attachments"] = self._files(post, included, "attachments") post, included, "images")
attr["attachments"] = self._files(
post, included, "attachments")
attr["attachments_media"] = self._files(
post, included, "attachments_media")
attr["date"] = text.parse_datetime( attr["date"] = text.parse_datetime(
attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z") attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z")

View File

@ -75,6 +75,17 @@ __tests__ = (
"#count" : 4, "#count" : 4,
}, },
{
"#url" : "https://www.patreon.com/posts/free-mari-8s-113049301",
"#comment" : "postfile + attachments_media (#6241)",
"#class" : patreon.PatreonPostExtractor,
"#pattern" : [
r"https://c10\.patreonusercontent\.com/4/patreon-media/p/post/113049301/7ae4fd78d3374d849a80863f3d8eee89/eyJhIjoxLCJwIjoxfQ%3D%3D/1\.jpg",
r"https://c10\.patreonusercontent\.com/4/patreon-media/p/post/113049301/b6ea96b18cbc47f78f9334d50d0877ea/eyJhIjoxLCJwIjoxfQ%3D%3D/1\.mp4",
r"https://c10\.patreonusercontent\.com/4/patreon-media/p/post/113049301/62dc1d4194db4245aca31c56f71234ed/eyJhIjoxLCJwIjoxfQ%3D%3D/1\.mp4",
],
},
{ {
"#url" : "https://www.patreon.com/posts/56127163", "#url" : "https://www.patreon.com/posts/56127163",
"#comment" : "account suspended", "#comment" : "account suspended",