[soundgasm] add 'audio' extractor (#3384)

pull/3406/head
Mike Fährmann 2 years ago
parent dfe7b23579
commit eb94568e1f
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -769,6 +769,12 @@ Consider all sites to be NSFW unless otherwise known.
<td>Albums, individual Images, Images from Users and Folders</td>
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
</tr>
<tr>
<td>Soundgasm</td>
<td>https://soundgasm.net/</td>
<td>Audio</td>
<td></td>
</tr>
<tr>
<td>Speaker Deck</td>
<td>https://speakerdeck.com/</td>

@ -130,6 +130,7 @@ modules = [
"slickpic",
"slideshare",
"smugmug",
"soundgasm",
"speakerdeck",
"subscribestar",
"tapas",

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extractors for https://soundgasm.net/"""
from .common import Extractor, Message
from .. import text
class SoundgasmAudioExtractor(Extractor):
"""Extractor for audio clips from soundgasm.net"""
category = "soundgasm"
root = "https://soundgasm.net"
directory_fmt = ("{category}", "{user}")
filename_fmt = "{title}.{extension}"
archive_fmt = "{user}_{filename}"
pattern = r"(?:https?://)?(?:www\.)?soundgasm\.net/u/([^/?#]+)/([^/?#]+)"
test = (
(("https://soundgasm.net/u/ClassWarAndPuppies2"
"/687-Otto-von-Toontown-12822"), {
"pattern": r"https://media\.soundgasm\.net/sounds"
r"/26cb2b23b2f2c6094b40ee3a9167271e274b570a\.m4a",
"keyword": {
"description": "We celebrate todays important prisoner swap, "
"and finally bring the 2022 mid-terms to a clos"
"e with Raphael Warnocks defeat of Herschel Wa"
"lker in Georgia. Then, we take a look at the Q"
"anon-addled attempt to overthrow the German go"
"vernment and install Heinrich XIII Prince of R"
"euss as kaiser.",
"extension": "m4a",
"filename": "26cb2b23b2f2c6094b40ee3a9167271e274b570a",
"slug": "687-Otto-von-Toontown-12822",
"title": "687 - Otto von Toontown (12/8/22)",
"user": "ClassWarAndPuppies2",
},
}),
)
def __init__(self, match):
Extractor.__init__(self, match)
self.user, self.slug = match.groups()
def items(self):
url = "{}/u/{}/{}".format(self.root, self.user, self.slug)
extr = text.extract_from(self.request(url).text)
data = {
"user" : self.user,
"slug" : self.slug,
"title": text.unescape(extr('aria-label="title">', "<")),
"description": text.unescape(text.remove_html(extr(
'class="jp-description">', '</div>'))),
}
formats = extr('"setMedia", {', '}')
url = text.extr(formats, ': "', '"')
yield Message.Directory, data
yield Message.Url, url, text.nameext_from_url(url, data)
Loading…
Cancel
Save