Skip to content

Commit

Permalink
[Epidemic Sound] Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
realRobotix committed Nov 6, 2023
1 parent 0949641 commit d8c1711
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions youtube_dl/extractor/epidemicsound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
}
'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'),
}

0 comments on commit d8c1711

Please sign in to comment.