[soundgasm] add 'user' extractor (#3384)
based on code from PR #3388 by @enduser420
This commit is contained in:
@@ -772,7 +772,7 @@ Consider all sites to be NSFW unless otherwise known.
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Soundgasm</td>
|
<td>Soundgasm</td>
|
||||||
<td>https://soundgasm.net/</td>
|
<td>https://soundgasm.net/</td>
|
||||||
<td>Audio</td>
|
<td>Audio, User Profiles</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ from .. import text
|
|||||||
class SoundgasmAudioExtractor(Extractor):
|
class SoundgasmAudioExtractor(Extractor):
|
||||||
"""Extractor for audio clips from soundgasm.net"""
|
"""Extractor for audio clips from soundgasm.net"""
|
||||||
category = "soundgasm"
|
category = "soundgasm"
|
||||||
|
subcategory = "audio"
|
||||||
root = "https://soundgasm.net"
|
root = "https://soundgasm.net"
|
||||||
directory_fmt = ("{category}", "{user}")
|
directory_fmt = ("{category}", "{user}")
|
||||||
filename_fmt = "{title}.{extension}"
|
filename_fmt = "{title}.{extension}"
|
||||||
archive_fmt = "{user}_{filename}"
|
archive_fmt = "{user}_{filename}"
|
||||||
pattern = r"(?:https?://)?(?:www\.)?soundgasm\.net/u/([^/?#]+)/([^/?#]+)"
|
pattern = (r"(?:https?://)?(?:www\.)?soundgasm\.net"
|
||||||
|
r"/u(?:ser)?/([^/?#]+)/([^/?#]+)")
|
||||||
test = (
|
test = (
|
||||||
(("https://soundgasm.net/u/ClassWarAndPuppies2"
|
(("https://soundgasm.net/u/ClassWarAndPuppies2"
|
||||||
"/687-Otto-von-Toontown-12822"), {
|
"/687-Otto-von-Toontown-12822"), {
|
||||||
@@ -40,6 +42,8 @@ class SoundgasmAudioExtractor(Extractor):
|
|||||||
"user": "ClassWarAndPuppies2",
|
"user": "ClassWarAndPuppies2",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
("https://www.soundgasm.net/user/ClassWarAndPuppies2"
|
||||||
|
"/687-Otto-von-Toontown-12822"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
@@ -63,3 +67,27 @@ class SoundgasmAudioExtractor(Extractor):
|
|||||||
|
|
||||||
yield Message.Directory, data
|
yield Message.Directory, data
|
||||||
yield Message.Url, url, text.nameext_from_url(url, data)
|
yield Message.Url, url, text.nameext_from_url(url, data)
|
||||||
|
|
||||||
|
|
||||||
|
class SoundgasmUserExtractor(Extractor):
|
||||||
|
"""Extractor for all sounds from a soundgasm user"""
|
||||||
|
category = "soundgasm"
|
||||||
|
subcategory = "user"
|
||||||
|
root = "https://soundgasm.net"
|
||||||
|
pattern = (r"(?:https?://)?(?:www\.)?soundgasm\.net"
|
||||||
|
r"/u(?:ser)?/([^/?#]+)/?$")
|
||||||
|
test = ("https://soundgasm.net/u/fierce-aphrodite", {
|
||||||
|
"pattern": SoundgasmAudioExtractor.pattern,
|
||||||
|
"count" : ">= 15",
|
||||||
|
})
|
||||||
|
|
||||||
|
def __init__(self, match):
|
||||||
|
Extractor.__init__(self, match)
|
||||||
|
self.user = match.group(1)
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
page = self.request(self.root + "/user/" + self.user).text
|
||||||
|
data = {"_extractor": SoundgasmAudioExtractor}
|
||||||
|
for sound in text.extract_iter(
|
||||||
|
page, 'class="sound-details">', "</a>"):
|
||||||
|
yield Message.Queue, text.extr(sound, '<a href="', '"'), data
|
||||||
|
|||||||
Reference in New Issue
Block a user