Compare commits

..

2 Commits

Author SHA1 Message Date
sepro
50d47c5147 Update channel regex 2023-11-23 19:59:20 +01:00
sepro
f3370c4dc5
Apply suggestions from code review
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-11-23 19:58:22 +01:00

View File

@ -174,9 +174,8 @@ class FloatplaneIE(InfoExtractor):
}) })
uploader_url = format_field(traverse_obj( uploader_url = format_field(traverse_obj(
post_data, ('creator', 'urlname')), template='https://www.floatplane.com/channel/%s/home', default=None) post_data, 'creator'), 'urlname', 'https://www.floatplane.com/channel/%s/home', default=None)
channel_url = format_field(traverse_obj( channel_url = urljoin(f'{uploader_url}/', traverse_obj(post_data, ('channel', 'urlname')))
post_data, ('channel', 'urlname')), template=f'{uploader_url}/%s', default=None)
post_info = { post_info = {
'id': post_id, 'id': post_id,
@ -207,7 +206,7 @@ class FloatplaneIE(InfoExtractor):
class FloatplaneChannelIE(InfoExtractor): class FloatplaneChannelIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|beta)\.)?floatplane\.com/channel/(?P<id>[\w_]+)/home(?:/(?P<channel>[\w_]+))?' _VALID_URL = r'https?://(?:(?:www|beta)\.)?floatplane\.com/channel/(?P<id>[\w-]+)/home(?:/(?P<channel>[\w-]+))?'
_PAGE_SIZE = 20 _PAGE_SIZE = 20
_TESTS = [{ _TESTS = [{
'url': 'https://www.floatplane.com/channel/linustechtips/home/ltxexpo', 'url': 'https://www.floatplane.com/channel/linustechtips/home/ltxexpo',
@ -260,7 +259,7 @@ class FloatplaneChannelIE(InfoExtractor):
'https://www.floatplane.com/api/v3/creator/named', display_id, query={'creatorURL[0]': creator})[0] 'https://www.floatplane.com/api/v3/creator/named', display_id, query={'creatorURL[0]': creator})[0]
channel_data = traverse_obj( channel_data = traverse_obj(
creator_data, ('channels', lambda _, x: x['urlname'] == channel, {dict}), get_all=False) or {} creator_data, ('channels', lambda _, v: v['urlname'] == channel, {dict}), get_all=False) or {}
return self.playlist_result(OnDemandPagedList(functools.partial( return self.playlist_result(OnDemandPagedList(functools.partial(
self._fetch_page, display_id, creator_data['id'], channel_data.get('id')), self._PAGE_SIZE), display_id, self._fetch_page, display_id, creator_data['id'], channel_data.get('id')), self._PAGE_SIZE), display_id,