Skip to content

Conversation

@tpikonen
Copy link
Contributor

This PR allows subscribing to feeds with links to youtube-dl compatible content and a config var to enable streaming of unrecognized episode URLs with the configured video player.

Specifically:

  • Allow creation of custom downloaders in the youtube-dl extension for all URLs supported by youtube-dl
  • Accept episodes in RSS feeds where the 'link' element has an URL for which a custom downloader can be created
  • Remove legacy settings 'player' and 'videoplayer'
  • Add setting 'player.videoplayer_youtube_dl_support' which enables streaming of episodes with URLs with otherwise unrecognized file type

Downloads with youtube-dl work if a suitable format string is set to youtube.preferred_fmt_ids, but this setting is a bit non-obvious for my taste.

@elelay
Copy link
Member

elelay commented Jan 10, 2021

interesting 👍

@auouymous
Copy link
Member

Commit 386afb1 is not correct. I'm not sure what you are trying to do with it but both regex are identical, the first is checked against episode.url and second against episode.link. Compiling the regex is good idea though.

@tpikonen
Copy link
Contributor Author

I must have been asleep when I made the previous push, it should work now.

But, is checking episode.link really necessary? PodcastEpisode.from_podcastparser_entry() in model.py does not create an episode object without a verified episode.url. Testing the 'link' property when creating the downloader would be then useless, unless episodes are created some other way.

@auouymous
Copy link
Member

I don't know why the episode.link check happens but your cache patch appears to return episode.url for the episode.link branch.

As for the force default download, does that mean youtube-dl won't be used to download a DRM video that uses a known mime type?

@elelay
Copy link
Member

elelay commented Jan 15, 2021

@tpikonen What's the point of 0406835?

@tpikonen
Copy link
Contributor Author

@elelay youtube-dl supports URLs to downloadable files, so it will be always used as a downloader unless some kind of filtering is used. The commit was a quick fix to use the default downloader for the usual media file mime types.

On second thought it's better to make this filtering in the extension itself. Suggestions on what mime types, extensions etc. should and should not be downloaded by youtube-dl would be welcome.

@tpikonen
Copy link
Contributor Author

The extension now rejects downloads which would use the Generic youtube-dl extractor. This is a bit slow way to check for suitable URLs (0.3 s on my i5 laptop), but works as intended, so that normal media files are downloaded with the default downloader. Prefiltering by mime type or file extension from URL could be still implemented on top of this.

I tried to look if there are places in gpodder code where episodes without a valid 'url' attribute are be created, but could not find any, so I removed support for URLs in episode.link. If code creating episodes without an 'url' is there, I think it's better to treat it as buggy.

Also rebased to current master.

@tpikonen
Copy link
Contributor Author

tpikonen commented Feb 1, 2021

This PR currently contains basically two changes:

  1. Make the youtube-dl extension support all the URLs supported by youtube-dl and accept episodes from feeds where the episode.link element is supported by youtube-dl or other downloader.
  2. Stream episode.url links directly with the video player if a custom downloader exists and a config var is set.

The second change is arguably a bit hacky, but would the first change be acceptable? I can split these two into separate PRs if so.

@auouymous
Copy link
Member

What feeds does this PR fix?

@tpikonen
Copy link
Contributor Author

tpikonen commented Feb 1, 2021

I'm using this to follow radio and tv shows from the Finnish broadcaster Yle. The feeds are at https://feeds.yle.fi/ (example: https://feeds.yle.fi/areena/v1/series/1-50697851.rss). There are some feeds there with normal media enclosures, but most are only accessible from the streaming service at areena.yle.fi via the episode link.

Copy link
Member

@elelay elelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also split out the player handling (and update to player.audio) in a separate PR.

@tpikonen tpikonen changed the title Allow episodes with youtube-dl compatible links, add config var to allow streaming them Allow episodes with youtube-dl compatible URLs Feb 11, 2021
@tpikonen
Copy link
Contributor Author

Rebased to master. @elelay are there further issues with the code?

@elelay
Copy link
Member

elelay commented May 10, 2021

LGTM, but I can't test the improvement it brings

@auouymous
Copy link
Member

I agree, the code looks good but https://feeds.yle.fi/areena/v1/series/1-50697851.rss still doesn't contain any episodes.

Skip image and application URLs in enclosure if media with audio or
video is found, or if a CustomDownloader exists for episode.link URL.
@tpikonen
Copy link
Contributor Author

The YLE feeds are a bad example, since they need a patched youtube-dl, but that's what I use this PR for.

There are 3rd party feeds for the BBC iPlayer which work, modulo geoblocking (and the server is really slow).

Then there is RSS-bridge which has feeds for lots of things, like Bandcamp (example).

These feeds have images in enclosures, so I changed the feed parsing to reject them in favor of episode.link, when there is something to download there.

Also, the youtube-dl extension needs improving in format handling, but here's quick hack if anyone wants to test the feeds above:

diff --git a/share/gpodder/extensions/youtube-dl.py b/share/gpodder/extensions/youtube-dl.py
index 2704ca8a..3368f7b2 100644
--- a/share/gpodder/extensions/youtube-dl.py
+++ b/share/gpodder/extensions/youtube-dl.py
@@ -311,6 +311,7 @@ class gPodderYoutubeDL(download.CustomDownloader):
         opts['format'] = '/'.join(str(fmt) for fmt in fmt_ids)
         if fallback:
             opts['format'] += '/' + fallback
+        opts['format'] += '/bestvideo+bestaudio[abr<=256]/bestaudio[abr<=256]/best'
         logger.debug('format=%s', opts['format'])
 
     def fetch_video(self, url, tempname, reporthook):

@elelay elelay merged commit 56e8f47 into gpodder:master May 16, 2021
@elelay
Copy link
Member

elelay commented May 16, 2021

Merged, thanks

@tpikonen
Copy link
Contributor Author

Thanks for merging. I have some ideas to improve #963 so that streaming can be made to work for ytdl-links as well.

@tpikonen tpikonen deleted the ytdl-streaming branch May 16, 2021 16:14
@elelay
Copy link
Member

elelay commented May 16, 2021

Thanks, I've seen your comment above about improving format handling in the youtube-dl extension.
Looking forward to it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants