]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/freesound.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   8 class FreesoundIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'https?://(?:www\.)?freesound\.org/people/([^/]+)/sounds/(?P<id>[^/]+)' 
  11         'url': 'http://www.freesound.org/people/miklovan/sounds/194503/', 
  12         'md5': '12280ceb42c81f19a515c745eae07650', 
  16             'title': 'gulls in the city.wav', 
  17             'uploader': 'miklovan', 
  18             'description': 'the sounds of seagulls in the city', 
  22     def _real_extract(self
, url
): 
  23         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  24         music_id 
= mobj
.group('id') 
  25         webpage 
= self
._download
_webpage
(url
, music_id
) 
  26         title 
= self
._html
_search
_regex
( 
  27             r
'<div id="single_sample_header">.*?<a href="#">(.+?)</a>', 
  28             webpage
, 'music title', flags
=re
.DOTALL
) 
  29         description 
= self
._html
_search
_regex
( 
  30             r
'<div id="sound_description">(.*?)</div>', webpage
, 'description', 
  31             fatal
=False, flags
=re
.DOTALL
) 
  36             'url': self
._og
_search
_property
('audio', webpage
, 'music url'), 
  37             'uploader': self
._og
_search
_property
('audio:artist', webpage
, 'music uploader'), 
  38             'description': description
,