]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/soundgasm.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class SoundgasmIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?soundgasm\.net/u/(?P<user>[0-9a-zA-Z_\-]+)/(?P<title>[0-9a-zA-Z_\-]+)'
13 'url': 'http://soundgasm.net/u/ytdl/Piano-sample',
14 'md5': '010082a2c802c5275bb00030743e75ad',
16 'id': '88abd86ea000cafe98f96321b23cc1206cbcbcc9',
18 'title': 'ytdl_Piano-sample',
19 'description': 'Royalty Free Sample Music'
23 def _real_extract(self
, url
):
24 mobj
= re
.match(self
._VALID
_URL
, url
)
25 display_id
= mobj
.group('title')
26 audio_title
= mobj
.group('user') + '_' + mobj
.group('title')
27 webpage
= self
._download
_webpage
(url
, display_id
)
28 audio_url
= self
._html
_search
_regex
(
29 r
'(?s)m4a\:\s"([^"]+)"', webpage
, 'audio URL')
30 audio_id
= re
.split('\/|\.', audio_url
)[-2]
31 description
= self
._html
_search
_regex
(
32 r
'(?s)<li>Description:\s(.*?)<\/li>', webpage
, 'description',
37 'display_id': display_id
,
40 'description': description
44 class SoundgasmProfileIE(InfoExtractor
):
45 IE_NAME
= 'soundgasm:profile'
46 _VALID_URL
= r
'https?://(?:www\.)?soundgasm\.net/u/(?P<id>[^/]+)/?(?:\#.*)?$'
48 'url': 'http://soundgasm.net/u/ytdl',
55 def _real_extract(self
, url
):
56 profile_id
= self
._match
_id
(url
)
58 webpage
= self
._download
_webpage
(url
, profile_id
)
61 self
.url_result(audio_url
, 'Soundgasm')
62 for audio_url
in re
.findall(r
'href="([^"]+/u/%s/[^"]+)' % profile_id
, webpage
)]
64 return self
.playlist_result(entries
, profile_id
)