]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/clyp.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
  10 class ClypIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://(?:www\.)?clyp\.it/(?P<id>[a-z0-9]+)' 
  13         'url': 'https://clyp.it/ojz2wfah', 
  14         'md5': '1d4961036c41247ecfdcc439c0cddcbb', 
  18             'title': 'Krisson80 - bits wip wip', 
  19             'description': '#Krisson80BitsWipWip #chiptune\n#wip', 
  21             'timestamp': 1443515251, 
  22             'upload_date': '20150929', 
  26     def _real_extract(self
, url
): 
  27         audio_id 
= self
._match
_id
(url
) 
  29         metadata 
= self
._download
_json
( 
  30             'https://api.clyp.it/%s' % audio_id
, audio_id
) 
  33         for secure 
in ('', 'Secure'): 
  34             for ext 
in ('Ogg', 'Mp3'): 
  35                 format_id 
= '%s%s' % (secure
, ext
) 
  36                 format_url 
= metadata
.get('%sUrl' % format_id
) 
  40                         'format_id': format_id
, 
  43         self
._sort
_formats
(formats
) 
  45         title 
= metadata
['Title'] 
  46         description 
= metadata
.get('Description') 
  47         duration 
= float_or_none(metadata
.get('Duration')) 
  48         timestamp 
= parse_iso8601(metadata
.get('DateCreated')) 
  53             'description': description
, 
  55             'timestamp': timestamp
,