Compare commits

..

3 Commits

Author SHA1 Message Date
sepro
90b4d5c99a Add more type checks 2024-01-22 06:40:44 +01:00
sepro
07545efd03 Inline channel_url 2024-01-22 06:26:19 +01:00
sepro
a2023cc0b4
Apply suggestions from code review 2024-01-22 04:47:17 +01:00

View File

@ -11,6 +11,7 @@ from ..utils import (
join_nonempty, join_nonempty,
parse_codecs, parse_codecs,
parse_iso8601, parse_iso8601,
url_or_none,
urljoin, urljoin,
) )
from ..utils.traversal import traverse_obj from ..utils.traversal import traverse_obj
@ -112,7 +113,6 @@ class FloatplaneIE(InfoExtractor):
'url': 'https://www.floatplane.com/post/65B5PNoBtf', 'url': 'https://www.floatplane.com/post/65B5PNoBtf',
'info_dict': { 'info_dict': {
'id': '65B5PNoBtf', 'id': '65B5PNoBtf',
'ext': None,
'description': 'I recorded the inbuilt demo mode for your 90\'s enjoyment, thanks for being Floaties!', 'description': 'I recorded the inbuilt demo mode for your 90\'s enjoyment, thanks for being Floaties!',
'display_id': '65B5PNoBtf', 'display_id': '65B5PNoBtf',
'like_count': int, 'like_count': int,
@ -124,15 +124,13 @@ class FloatplaneIE(InfoExtractor):
'channel_url': 'https://www.floatplane.com/channel/TheTrashNetwork/home/thedrumthing', 'channel_url': 'https://www.floatplane.com/channel/TheTrashNetwork/home/thedrumthing',
'comment_count': int, 'comment_count': int,
'title': 'The $50 electronic drum kit.', 'title': 'The $50 electronic drum kit.',
'duration': None,
'channel_id': '64424fe73cd58cbcf8d8e131', 'channel_id': '64424fe73cd58cbcf8d8e131',
'thumbnail': 'https://pbs.floatplane.com/blogPost_thumbnails/65B5PNoBtf/725555379422705_1701247052743.jpeg', 'thumbnail': 'https://pbs.floatplane.com/blogPost_thumbnails/65B5PNoBtf/725555379422705_1701247052743.jpeg',
'dislike_count': int, 'dislike_count': int,
'channel': 'The Drum Thing', 'channel': 'The Drum Thing',
'release_date': '20231129', 'release_date': '20231129',
}, },
'uploader_url': 'https://www.floatplane.com/channel/TheTrashNetwork/home', 'playlist_count': 2,
"playlist_count": 2,
'playlist': [{ 'playlist': [{
'info_dict': { 'info_dict': {
'id': 'ISPJjexylS', 'id': 'ISPJjexylS',
@ -158,7 +156,6 @@ class FloatplaneIE(InfoExtractor):
'release_timestamp': 1701249480, 'release_timestamp': 1701249480,
'title': 'Roland TD-7 Demo.m4a', 'title': 'Roland TD-7 Demo.m4a',
'channel_id': '64424fe73cd58cbcf8d8e131', 'channel_id': '64424fe73cd58cbcf8d8e131',
'thumbnail': None,
'availability': 'subscriber_only', 'availability': 'subscriber_only',
'uploader': 'The Trash Network', 'uploader': 'The Trash Network',
'duration': 114, 'duration': 114,
@ -188,19 +185,18 @@ class FloatplaneIE(InfoExtractor):
uploader_url = format_field( uploader_url = format_field(
post_data, [('creator', 'urlname')], 'https://www.floatplane.com/channel/%s/home') or None post_data, [('creator', 'urlname')], 'https://www.floatplane.com/channel/%s/home') or None
channel_url = urljoin(f'{uploader_url}/', traverse_obj(post_data, ('channel', 'urlname')))
common_info = { common_info = {
'uploader_url': uploader_url,
'channel_url': urljoin(f'{uploader_url}/', traverse_obj(post_data, ('channel', 'urlname'))),
'availability': self._availability(needs_subscription=True),
**traverse_obj(post_data, { **traverse_obj(post_data, {
'uploader': ('creator', 'title'), 'uploader': ('creator', 'title', {str}),
'uploader_id': ('creator', 'id'), 'uploader_id': ('creator', 'id', {str}),
'channel': ('channel', 'title'), 'channel': ('channel', 'title', {str}),
'channel_id': ('channel', 'id'), 'channel_id': ('channel', 'id', {str}),
'release_timestamp': ('releaseDate', {parse_iso8601}), 'release_timestamp': ('releaseDate', {parse_iso8601}),
}), }),
'uploader_url': uploader_url,
'channel_url': channel_url,
'availability': self._availability(needs_subscription=True),
} }
items = [] items = []
@ -229,11 +225,11 @@ class FloatplaneIE(InfoExtractor):
formats = [] formats = []
for quality in traverse_obj(stream, ('resource', 'data', 'qualityLevels', ...)): for quality in traverse_obj(stream, ('resource', 'data', 'qualityLevels', ...)):
url = urljoin(stream['cdn'], format_path(traverse_obj( url = urljoin(stream['cdn'], format_path(traverse_obj(
stream, ('resource', 'data', 'qualityLevelParams', quality['name'])))) stream, ('resource', 'data', 'qualityLevelParams', quality['name'], {dict}))))
formats.append({ formats.append({
**traverse_obj(quality, { **traverse_obj(quality, {
'format_id': 'name', 'format_id': ('name', {str}),
'format_note': 'label', 'format_note': ('label', {str}),
'width': ('width', {int}), 'width': ('width', {int}),
'height': ('height', {int}), 'height': ('height', {int}),
}), }),
@ -246,9 +242,9 @@ class FloatplaneIE(InfoExtractor):
**common_info, **common_info,
'id': media_id, 'id': media_id,
**traverse_obj(metadata, { **traverse_obj(metadata, {
'title': 'title', 'title': ('title', {str}),
'duration': ('duration', {int_or_none}), 'duration': ('duration', {int_or_none}),
'thumbnail': ('thumbnail', 'path'), 'thumbnail': ('thumbnail', 'path', {url_or_none}),
}), }),
'formats': formats, 'formats': formats,
}) })
@ -258,12 +254,12 @@ class FloatplaneIE(InfoExtractor):
'id': post_id, 'id': post_id,
'display_id': post_id, 'display_id': post_id,
**traverse_obj(post_data, { **traverse_obj(post_data, {
'title': 'title', 'title': ('title', {str}),
'description': ('text', {clean_html}), 'description': ('text', {clean_html}),
'like_count': ('likes', {int_or_none}), 'like_count': ('likes', {int_or_none}),
'dislike_count': ('dislikes', {int_or_none}), 'dislike_count': ('dislikes', {int_or_none}),
'comment_count': ('comments', {int_or_none}), 'comment_count': ('comments', {int_or_none}),
'thumbnail': ('thumbnail', 'path'), 'thumbnail': ('thumbnail', 'path', {url_or_none}),
}), }),
} }