mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 19:52:11 +00:00
[soundgasm] PEP8 and add a display_id (#3155)
This commit is contained in:
parent
8333034dce
commit
ba7aa464de
1 changed files with 9 additions and 3 deletions
|
@ -5,6 +5,7 @@ import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class SoundgasmIE(InfoExtractor):
|
class SoundgasmIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?soundgasm\.net/u/(?P<user>[0-9a-zA-Z_\-]+)/(?P<title>[0-9a-zA-Z_\-]+)'
|
_VALID_URL = r'https?://(?:www\.)?soundgasm\.net/u/(?P<user>[0-9a-zA-Z_\-]+)/(?P<title>[0-9a-zA-Z_\-]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
|
@ -20,14 +21,19 @@ class SoundgasmIE(InfoExtractor):
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
display_id = mobj.group('title')
|
||||||
audio_title = mobj.group('user') + '_' + mobj.group('title')
|
audio_title = mobj.group('user') + '_' + mobj.group('title')
|
||||||
webpage = self._download_webpage(url, '')
|
webpage = self._download_webpage(url, display_id)
|
||||||
audio_url = self._html_search_regex(r'(?s)m4a\:\s"([^"]+)"', webpage, 'audio URL')
|
audio_url = self._html_search_regex(
|
||||||
|
r'(?s)m4a\:\s"([^"]+)"', webpage, 'audio URL')
|
||||||
audio_id = re.split('\/|\.', audio_url)[-2]
|
audio_id = re.split('\/|\.', audio_url)[-2]
|
||||||
description = self._html_search_regex(r'(?s)<li>Description:\s(.*?)<\/li>', webpage, 'description', fatal=False, flags=re.DOTALL)
|
description = self._html_search_regex(
|
||||||
|
r'(?s)<li>Description:\s(.*?)<\/li>', webpage, 'description',
|
||||||
|
fatal=False)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': audio_id,
|
'id': audio_id,
|
||||||
|
'display_id': display_id,
|
||||||
'url': audio_url,
|
'url': audio_url,
|
||||||
'title': audio_title,
|
'title': audio_title,
|
||||||
'description': description
|
'description': description
|
||||||
|
|
Loading…
Reference in a new issue