[subscribestar] Fix attachment download and add support for audio type
- We change the text.extr 3rd argument to match current structure
('class="post-edit_form"')
- We add support for uploads-audios based on a similar structure as the
attachment type:
- id = data-upload-id
- name = audio_preview-title
- url = src
- type = audio
Fix #6721
This commit is contained in:
@@ -98,7 +98,7 @@ class SubscribestarExtractor(Extractor):
|
|||||||
media.append(item)
|
media.append(item)
|
||||||
|
|
||||||
attachments = text.extr(
|
attachments = text.extr(
|
||||||
html, 'class="uploads-docs"', 'data-role="post-edit_form"')
|
html, 'class="uploads-docs"', 'class="post-edit_form"')
|
||||||
if attachments:
|
if attachments:
|
||||||
for att in attachments.split('class="doc_preview"')[1:]:
|
for att in attachments.split('class="doc_preview"')[1:]:
|
||||||
media.append({
|
media.append({
|
||||||
@@ -110,6 +110,19 @@ class SubscribestarExtractor(Extractor):
|
|||||||
"type": "attachment",
|
"type": "attachment",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
audios = text.extr(
|
||||||
|
html, 'class="uploads-audios"', 'class="post-edit_form"')
|
||||||
|
if audios:
|
||||||
|
for audio in audios.split('class="audio_preview-data"')[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
|
return media
|
||||||
|
|
||||||
def _data_from_post(self, html):
|
def _data_from_post(self, html):
|
||||||
|
|||||||
Reference in New Issue
Block a user