[extractor/clyp] Support `wav` (#6102)

Authored by: qulaz
pull/6030/merge
qulaz 2 years ago committed by GitHub
parent 989f47b631
commit cc13293c28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,22 +9,22 @@ from ..utils import (
class ClypIE(InfoExtractor): class ClypIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?clyp\.it/(?P<id>[a-z0-9]+)' _VALID_URL = r'https?://(?:www\.)?clyp\.it/(?P<id>[a-z0-9]+)'
_TESTS = [{ _TESTS = [{
'url': 'https://clyp.it/ojz2wfah', 'url': 'https://clyp.it/iynkjk4b',
'md5': '1d4961036c41247ecfdcc439c0cddcbb', 'md5': '4bc6371c65210e7b372097fce4d92441',
'info_dict': { 'info_dict': {
'id': 'ojz2wfah', 'id': 'iynkjk4b',
'ext': 'mp3', 'ext': 'ogg',
'title': 'Krisson80 - bits wip wip', 'title': 'research',
'description': '#Krisson80BitsWipWip #chiptune\n#wip', 'description': '#Research',
'duration': 263.21, 'duration': 51.278,
'timestamp': 1443515251, 'timestamp': 1435524981,
'upload_date': '20150929', 'upload_date': '20150628',
}, },
}, { }, {
'url': 'https://clyp.it/b04p1odi?token=b0078e077e15835845c528a44417719d', 'url': 'https://clyp.it/b04p1odi?token=b0078e077e15835845c528a44417719d',
'info_dict': { 'info_dict': {
'id': 'b04p1odi', 'id': 'b04p1odi',
'ext': 'mp3', 'ext': 'ogg',
'title': 'GJ! (Reward Edit)', 'title': 'GJ! (Reward Edit)',
'description': 'Metal Resistance (THE ONE edition)', 'description': 'Metal Resistance (THE ONE edition)',
'duration': 177.789, 'duration': 177.789,
@ -34,6 +34,17 @@ class ClypIE(InfoExtractor):
'params': { 'params': {
'skip_download': True, 'skip_download': True,
}, },
}, {
'url': 'https://clyp.it/v42214lc',
'md5': '4aca4dfc3236fb6d6ddc4ea08314f33f',
'info_dict': {
'id': 'v42214lc',
'ext': 'wav',
'title': 'i dont wanna go (old version)',
'duration': 113.528,
'timestamp': 1607348505,
'upload_date': '20201207',
},
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -59,6 +70,18 @@ class ClypIE(InfoExtractor):
'url': format_url, 'url': format_url,
'format_id': format_id, 'format_id': format_id,
'vcodec': 'none', 'vcodec': 'none',
'acodec': ext.lower(),
})
page = self._download_webpage(url, video_id=audio_id)
wav_url = self._html_search_regex(
r'var\s*wavStreamUrl\s*=\s*["\'](?P<url>https?://[^\'"]+)', page, 'url', default=None)
if wav_url:
formats.append({
'url': wav_url,
'format_id': 'wavStreamUrl',
'vcodec': 'none',
'acodec': 'wav',
}) })
title = metadata['Title'] title = metadata['Title']

Loading…
Cancel
Save