diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 3c7d6cf2..629cc1ee 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -769,6 +769,12 @@ Consider all sites to be NSFW unless otherwise known. Albums, individual Images, Images from Users and Folders OAuth + + Soundgasm + https://soundgasm.net/ + Audio + + Speaker Deck https://speakerdeck.com/ diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 3b553c84..98c43ca9 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -130,6 +130,7 @@ modules = [ "slickpic", "slideshare", "smugmug", + "soundgasm", "speakerdeck", "subscribestar", "tapas", diff --git a/gallery_dl/extractor/soundgasm.py b/gallery_dl/extractor/soundgasm.py new file mode 100644 index 00000000..e0c1c361 --- /dev/null +++ b/gallery_dl/extractor/soundgasm.py @@ -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 today’s important prisoner swap, " + "and finally bring the 2022 mid-terms to a clos" + "e with Raphael Warnock’s 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">', ''))), + } + + formats = extr('"setMedia", {', '}') + url = text.extr(formats, ': "', '"') + + yield Message.Directory, data + yield Message.Url, url, text.nameext_from_url(url, data)