mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 16:51:26 +01:00
Compare commits
No commits in common. "ebedb7f01e575df89075d6aff56d249c92d85b5a" and "ddb255342d8fabc4b760673a267297235aec65ae" have entirely different histories.
ebedb7f01e
...
ddb255342d
|
@ -1,9 +1,12 @@
|
|||
import re
|
||||
import json
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import format_field, parse_iso8601
|
||||
|
||||
|
||||
class RinseFMIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
|
||||
_VALID_URL = r'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>.+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://rinse.fm/episodes/cameo-blush-01-09-2023-2300/',
|
||||
'md5': '9284abbd785e6b86e67d1cdca6224feb',
|
||||
|
@ -12,8 +15,6 @@ class RinseFMIE(InfoExtractor):
|
|||
'ext': 'mp3',
|
||||
'title': 'Cameo Blush - 01/09/2023 - 23:00',
|
||||
'thumbnail': r're:^https?://.*\.JPG$',
|
||||
'release_timestamp': 1693522800,
|
||||
'release_date': '20230831'
|
||||
}
|
||||
}]
|
||||
|
||||
|
@ -21,13 +22,24 @@ class RinseFMIE(InfoExtractor):
|
|||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
entry = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['entry']
|
||||
response = re.findall(r'<script[^>]*id\s*=\s*[\'"]__NEXT_DATA__[\'"][^>]*>(.*?)<\/script>', webpage, re.DOTALL)
|
||||
info = json.loads(response[0])
|
||||
|
||||
entry = info['props']['pageProps']['entry']
|
||||
|
||||
track_id = entry['id']
|
||||
title = entry['title']
|
||||
|
||||
date_obj = datetime.fromisoformat(entry['episodeDate'])
|
||||
unix_timestamp = int(date_obj.replace(tzinfo=timezone.utc).timestamp())
|
||||
|
||||
url = entry['fileUrl']
|
||||
thumbnail = "https://rinse.imgix.net/media/" + entry['featuredImage'][0]['filename']
|
||||
|
||||
return {
|
||||
'id': entry['id'],
|
||||
'title': entry.get('title'),
|
||||
'url': entry['fileUrl'],
|
||||
'vcodec': 'none',
|
||||
'release_timestamp': parse_iso8601(entry.get('episodeDate')),
|
||||
'thumbnail': format_field(
|
||||
entry, [('featuredImage', 0, 'filename')], 'https://rinse.imgix.net/media/%s', default=None),
|
||||
'id': track_id,
|
||||
'title': title,
|
||||
'url': url,
|
||||
'release_timestamp': unix_timestamp,
|
||||
'thumbnail': thumbnail
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user