merge #6758: [subscribestar] fix attachment downloads and add support for audio type

(#6721, #>6724)
This commit is contained in:
Mike Fährmann
2025-01-02 18:25:37 +01:00
2 changed files with 36 additions and 2 deletions

View File

@@ -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)"
@@ -98,9 +99,10 @@ class SubscribestarExtractor(Extractor):
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="', '"')),
@@ -110,6 +112,20 @@ class SubscribestarExtractor(Extractor):
"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):