1 from .common
import InfoExtractor
9 class ClypIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?clyp\.it/(?P<id>[a-z0-9]+)'
12 'url': 'https://clyp.it/iynkjk4b',
13 'md5': '4bc6371c65210e7b372097fce4d92441',
18 'description': '#Research',
20 'timestamp': 1435524981,
21 'upload_date': '20150628',
24 'url': 'https://clyp.it/b04p1odi?token=b0078e077e15835845c528a44417719d',
28 'title': 'GJ! (Reward Edit)',
29 'description': 'Metal Resistance (THE ONE edition)',
31 'timestamp': 1528241278,
32 'upload_date': '20180605',
35 'skip_download': True,
38 'url': 'https://clyp.it/v42214lc',
39 'md5': '4aca4dfc3236fb6d6ddc4ea08314f33f',
43 'title': 'i dont wanna go (old version)',
45 'timestamp': 1607348505,
46 'upload_date': '20201207',
50 def _real_extract(self
, url
):
51 audio_id
= self
._match
_id
(url
)
54 token
= qs
.get('token', [None])[0]
58 query
['token'] = token
60 metadata
= self
._download
_json
(
61 f
'https://api.clyp.it/{audio_id}', audio_id
, query
=query
)
64 for secure
in ('', 'Secure'):
65 for ext
in ('Ogg', 'Mp3'):
66 format_id
= f
'{secure}{ext}'
67 format_url
= metadata
.get(f
'{format_id}Url')
71 'format_id': format_id
,
73 'acodec': ext
.lower(),
76 page
= self
._download
_webpage
(url
, video_id
=audio_id
)
77 wav_url
= self
._html
_search
_regex
(
78 r
'var\s*wavStreamUrl\s*=\s*["\'](?P
<url
>https?
://[^
\'"]+)', page, 'url', default=None)
82 'format_id': 'wavStreamUrl',
87 title = metadata['Title']
88 description = metadata.get('Description')
89 duration = float_or_none(metadata.get('Duration'))
90 timestamp = unified_timestamp(metadata.get('DateCreated'))
95 'description': description,
97 'timestamp': timestamp,