1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-06-02 10:29:28 +00:00

[Epidemic Sound] Add simple extractor

This commit is contained in:
realRobotix 2023-11-06 10:51:31 +01:00
parent 00ef748cc0
commit 09496419ad
No known key found for this signature in database
GPG key ID: 7F4C32C9D72DAF0F
2 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,41 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from datetime import datetime
class EpidemicSoundIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?epidemicsound\.com/track/(?P<id>[0-9a-zA-Z]+)'
_TEST = {
'url': 'https://www.epidemicsound.com/track/yFfQVRpSPz/',
'md5': 'd98ff2ddb49e8acab9716541cbc9dfac',
'info_dict': {
'id': 'yFfQVRpSPz',
'ext': 'mp3',
'tags': ['foley', 'door', 'knock', 'glass', 'window', 'glass door knock'],
'title': 'Door Knock Door 1',
'duration': 1,
'thumbnail': 'https://cdn.epidemicsound.com/curation-assets/commercial-release-cover-images/default-sfx/3000x3000.jpg',
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._download_json('https://www.epidemicsound.com/json/track/' + video_id, video_id)
title = json_data.get('title')
image_url = json_data.get('imageUrl')
media_url = json_data.get('stems').get('full').get('lqMp3Url')
media_len = json_data.get('length')
timestamp = int(datetime.strptime(json_data.get('added'), '%Y-%m-%dT%H:%M:%S').timestamp())
tags = json_data.get('metadataTags')
return {
'id': video_id,
'url': media_url,
'tags': tags,
'title': title,
'duration': media_len,
'timestamp': timestamp,
'thumbnail': image_url,
}

View file

@ -357,6 +357,7 @@ from .ellentube import (
from .elpais import ElPaisIE from .elpais import ElPaisIE
from .embedly import EmbedlyIE from .embedly import EmbedlyIE
from .engadget import EngadgetIE from .engadget import EngadgetIE
from .epidemicsound import EpidemicSoundIE
from .eporner import EpornerIE from .eporner import EpornerIE
from .eroprofile import EroProfileIE from .eroprofile import EroProfileIE
from .escapist import EscapistIE from .escapist import EscapistIE