New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ie/floatplane] Add extractor #8639
Conversation
Shouldnt display id and id be swapped? I think we would also have to do the workaround for flat filtering here by forcing return type |
Swapping
I'm not quite sure what you are referring to. Do I need to add |
Initially, I didn't want to bother with this, but it seemed easy enough
Co-authored-by: Simon Sawicki <accounts@grub4k.xyz>
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
uploader_url = format_field(traverse_obj( | ||
post_data, 'creator'), 'urlname', 'https://www.floatplane.com/channel/%s/home', default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, format_field
does traverse_obj(obj, *variadic(field))
. So you don't need traverse_obj inside it again.
format_field(post_data, [('creator', 'urlname')], 'https://www.floatplane.com/channel/%s/home') or None
Alternately, this also works:
traverse_obj(post_data, ('creator', 'urlname', {lambda x: f'https://www.floatplane.com/channel/{x}/home'}))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I tried that, but didn't realize field needs to be put in a list. Good suggestion.
The alternative could end up with https://www.floatplane.com/channel/None/home
if len(items) > 1: | ||
return self.playlist_result(items, **post_info) | ||
|
||
post_info.update(items[0]) | ||
return post_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We see this pattern a lot. Should probably be a helper function. Maybe self.playlist_or_video_result(post_info, items)
display_id, playlist_title=channel_data.get('title') or creator_data.get('title'), | ||
playlist_description=channel_data.get('about') or creator_data.get('about')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
display_id, playlist_title=channel_data.get('title') or creator_data.get('title'), | |
playlist_description=channel_data.get('about') or creator_data.get('about')) | |
display_id, title=channel_data.get('title') or creator_data.get('title'), | |
description=channel_data.get('about') or creator_data.get('about')) |
is preferable imo.
yield self.url_result( | ||
f'https://www.floatplane.com/post/{post["id"]}', | ||
ie=FloatplaneIE, video_id=post['id'], video_title=post.get('title'), | ||
release_timestamp=parse_iso8601(post.get('releaseDate'))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, I'd prefer to not use video_title
keyword
yield self.url_result( | |
f'https://www.floatplane.com/post/{post["id"]}', | |
ie=FloatplaneIE, video_id=post['id'], video_title=post.get('title'), | |
release_timestamp=parse_iso8601(post.get('releaseDate'))) | |
yield self.url_result( | |
f'https://www.floatplane.com/post/{post["id"]}', | |
FloatplaneIE, id=post['id'], title=post.get('title'), | |
release_timestamp=parse_iso8601(post.get('releaseDate'))) |
Closes yt-dlp#5877, Closes yt-dlp#5912 Authored by: seproDev
IMPORTANT: PRs without the template will be CLOSED
Description of your pull request and other information
Alternative implementation to #5912, supporting audio entries and multiple videos in a single post.
Most posts on the site only contain a single video; thus I decided to only return a single video instead of a playlist in those cases and use the post metadata for that video. This is also how the site visually represents it.
Posts with multiple videos/audio files get returned as a playlist.
Fixes #5877, Closes #5912
Template
Before submitting a pull request make sure you have:
In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:
What is the purpose of your pull request?