Skip to content

Commit

Permalink
merge mikf#6758: [subscribestar] fix attachment downloads and add sup…
Browse files Browse the repository at this point in the history
…port for audio type

(mikf#6721, #>6724)
  • Loading branch information
mikf committed Jan 2, 2025
2 parents 2dd2c71 + 671297a commit 5767c08
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
20 changes: 18 additions & 2 deletions gallery_dl/extractor/subscribestar.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .common import Extractor, Message
from .. import text, util, exception
from ..cache import cache
import re

BASE_PATTERN = r"(?:https?://)?(?:www\.)?subscribestar\.(com|adult)"

Expand Down Expand Up @@ -98,9 +99,10 @@ def _media_from_post(self, html):
media.append(item)

attachments = text.extr(
html, 'class="uploads-docs"', 'data-role="post-edit_form"')
html, 'class="uploads-docs"', 'class="post-edit_form"')
if attachments:
for att in attachments.split('class="doc_preview"')[1:]:
for att in re.split(
r'class="doc_preview[" ]', attachments)[1:]:
media.append({
"id" : text.parse_int(text.extr(
att, 'data-upload-id="', '"')),
Expand All @@ -110,6 +112,20 @@ def _media_from_post(self, html):
"type": "attachment",
})

audios = text.extr(
html, 'class="uploads-audios"', 'class="post-edit_form"')
if audios:
for audio in re.split(
r'class="audio_preview-data[" ]', audios)[1:]:
media.append({
"id" : text.parse_int(text.extr(
audio, 'data-upload-id="', '"')),
"name": text.unescape(text.extr(
audio, 'audio_preview-title">', '<')),
"url" : text.unescape(text.extr(audio, 'src="', '"')),
"type": "audio",
})

return media

def _data_from_post(self, html):
Expand Down
18 changes: 18 additions & 0 deletions test/results/subscribestar.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@
"width" : 700,
},

{
"#url" : "https://www.subscribestar.com/posts/920015",
"#comment" : "attachment (#6721)",
"#category": ("", "subscribestar", "post"),
"#class" : subscribestar.SubscribestarPostExtractor,
"#range" : "2",
"#pattern" : r"https://ss-uploads-prod\.b-cdn\.net/uploads_v2/users/11/posts/920015/bc018a55-9668-47f4-a664-b5fd66b56aaa\.pdf\?token=.+",

"date" : "dt:2023-05-30 09:20:00",
"extension": "pdf",
"filename" : "Training for freelancers - Fiverr",
"id" : 1957727,
"name" : "Training for freelancers - Fiverr.pdf",
"num" : 2,
"post_id" : 920015,
"type" : "attachment",
},

{
"#url" : "https://subscribestar.adult/posts/22950",
"#category": ("", "subscribestar", "post-adult"),
Expand Down

0 comments on commit 5767c08

Please sign in to comment.