]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/freesound.py
de14b12e5da28b61c9c23fc568c4a3d497e7e24a
3 from .common
import InfoExtractor
4 from ..utils
import determine_ext
6 class FreesoundIE(InfoExtractor
):
7 _VALID_URL
= r
'(?:https?://)?(?:www\.)?freesound\.org/people/([^/]+)/sounds/(?P<id>[^/]+)'
9 u
'url': u
'http://www.freesound.org/people/miklovan/sounds/194503/',
10 u
'file': u
'194503.mp3',
11 u
'md5': u
'12280ceb42c81f19a515c745eae07650',
13 u
"title": u
"gulls in the city.wav",
14 u
"uploader" : u
"miklovan",
15 u
'description': u
'the sounds of seagulls in the city',
19 def _real_extract(self
, url
):
20 mobj
= re
.match(self
._VALID
_URL
, url
)
21 music_id
= mobj
.group('id')
22 webpage
= self
._download
_webpage
(url
, music_id
)
23 title
= self
._html
_search
_regex
(r
'<div id="single_sample_header">.*?<a href="#">(.+?)</a>',
24 webpage
, 'music title', flags
=re
.DOTALL
)
25 music_url
= self
._og
_search
_property
('audio', webpage
, 'music url')
26 description
= self
._html
_search
_regex
(r
'<div id="sound_description">(.*?)</div>',
27 webpage
, 'description', fatal
=False, flags
=re
.DOTALL
)
33 'uploader': self
._og
_search
_property
('audio:artist', webpage
, 'music uploader'),
34 'ext': determine_ext(music_url
),
35 'description': description
,