You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@staticmethod
def _media_from_post(html):
media = []
gallery = text.extract(html, 'data-gallery="', '"')[0]
if gallery:
media.extend(
item for item in json.loads(text.unescape(gallery))
if "/previews/" not in item["url"]
)
attachments = text.extract(
html, 'class="uploads-docs"', 'data-role="post-edit_form"')[0]
if attachments:
for att in attachments.split('class="doc_preview"')[1:]:
media.append({
"id" : text.parse_int(text.extract(att, 'data-upload-id="', '"')[0]),
"url" : text.extract(att, 'href="', '"')[0],
"nice_name" : text.extract(att, 'doc_preview-title">', '</span')[0],
"type": "attachment",
})
return media
The text was updated successfully, but these errors were encountered:
Currently, subscribestar attachments can have nice human-readable filenames. However, the actual linked file is named with a random UUID.
There seems to be no way to access this currently, which is supported by looking at the source.
Patching
_media_from_post()
to include it is pretty simple:The text was updated successfully, but these errors were encountered: