mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-12 18:31:25 +01:00
Compare commits
6 Commits
ddb255342d
...
ebedb7f01e
Author | SHA1 | Date | |
---|---|---|---|
|
ebedb7f01e | ||
|
abf6550b65 | ||
|
b97478b8e8 | ||
|
fb975fce8a | ||
|
48c04b4ee3 | ||
|
48c38b3d0f |
|
@ -1,12 +1,9 @@
|
|||
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',
|
||||
|
@ -15,6 +12,8 @@ class RinseFMIE(InfoExtractor):
|
|||
'ext': 'mp3',
|
||||
'title': 'Cameo Blush - 01/09/2023 - 23:00',
|
||||
'thumbnail': r're:^https?://.*\.JPG$',
|
||||
'release_timestamp': 1693522800,
|
||||
'release_date': '20230831'
|
||||
}
|
||||
}]
|
||||
|
||||
|
@ -22,24 +21,13 @@ class RinseFMIE(InfoExtractor):
|
|||
video_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
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']
|
||||
|
||||
entry = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['entry']
|
||||
return {
|
||||
'id': track_id,
|
||||
'title': title,
|
||||
'url': url,
|
||||
'release_timestamp': unix_timestamp,
|
||||
'thumbnail': thumbnail
|
||||
'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),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user