From d8c171109064b308d49e8ee013f4d27eedbd83f6 Mon Sep 17 00:00:00 2001 From: realRobotix <82544307+realRobotix@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:00:29 +0100 Subject: [PATCH] [Epidemic Sound] Cleanup code --- youtube_dl/extractor/epidemicsound.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/youtube_dl/extractor/epidemicsound.py b/youtube_dl/extractor/epidemicsound.py index df8cb8408..3fe9363f5 100644 --- a/youtube_dl/extractor/epidemicsound.py +++ b/youtube_dl/extractor/epidemicsound.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from .common import InfoExtractor -from datetime import datetime +from ..utils import unified_timestamp class EpidemicSoundIE(InfoExtractor): @@ -17,25 +17,21 @@ class EpidemicSoundIE(InfoExtractor): 'title': 'Door Knock Door 1', 'duration': 1, 'thumbnail': 'https://cdn.epidemicsound.com/curation-assets/commercial-release-cover-images/default-sfx/3000x3000.jpg', + 'timestamp': 1415320353, + 'upload_date': '20141107', } } 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, - } \ No newline at end of file + 'url': json_data.get('stems').get('full').get('lqMp3Url'), + 'tags': json_data.get('metadataTags'), + 'title': json_data.get('title'), + 'duration': json_data.get('length'), + 'timestamp': unified_timestamp(json_data.get('added')), + 'thumbnail': json_data.get('imageUrl'), + }