]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/clyp.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
11 class ClypIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?clyp\.it/(?P<id>[a-z0-9]+)'
14 'url': 'https://clyp.it/ojz2wfah',
15 'md5': '1d4961036c41247ecfdcc439c0cddcbb',
19 'title': 'Krisson80 - bits wip wip',
20 'description': '#Krisson80BitsWipWip #chiptune\n#wip',
22 'timestamp': 1443515251,
23 'upload_date': '20150929',
26 'url': 'https://clyp.it/b04p1odi?token=b0078e077e15835845c528a44417719d',
30 'title': 'GJ! (Reward Edit)',
31 'description': 'Metal Resistance (THE ONE edition)',
33 'timestamp': 1528241278,
34 'upload_date': '20180605',
37 'skip_download': True,
41 def _real_extract(self
, url
):
42 audio_id
= self
._match
_id
(url
)
45 token
= qs
.get('token', [None])[0]
49 query
['token'] = token
51 metadata
= self
._download
_json
(
52 'https://api.clyp.it/%s' % audio_id
, audio_id
, query
=query
)
55 for secure
in ('', 'Secure'):
56 for ext
in ('Ogg', 'Mp3'):
57 format_id
= '%s%s' % (secure
, ext
)
58 format_url
= metadata
.get('%sUrl' % format_id
)
62 'format_id': format_id
,
65 self
._sort
_formats
(formats
)
67 title
= metadata
['Title']
68 description
= metadata
.get('Description')
69 duration
= float_or_none(metadata
.get('Duration'))
70 timestamp
= unified_timestamp(metadata
.get('DateCreated'))
75 'description': description
,
77 'timestamp': timestamp
,