TeamNewPipe / TeamNewPipe/NewPipeExtractor

youtube-dl backend

Open
#684 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

meta
Dominant language
Java
Stars
2k
Forks
602
Avg merge
3d 6h
Merged PRs (30d)
6

Description

Due to the nature of its task, NPE often has major issues which is very detrimental to the UX.

What would you think of an (optional?) youtube-dl-based backend? Their extractor is usually more reliable and updated faster to accommodate for youtube's frequent changes.

The NPE would still need to be used for things that enable browsing the website which youtube-dl doesn't support and probably won't support in the future either.

It would also open up limited access to tonnes of other websites (viewing only, browsing isn't supported by youtube-dl).

Is this something worth pursuing?

The largest question mark is the integration of youtube-dl itself since Python and Android don't mix well but approaches have been demonstrated that wrap around a statically compiled Linux binary (https://github.com/mpv-android/mpv-android/pull/58) which is hackish but should work just fine.

Obviously there are size concerns, so I did a quick build with NixOS/Nixpkgs@d8f8f31af9d77a48220e4e8a301d1e79774cb7d2:

pkgsCross.aarch64-multiplatform.pkgsStatic.youtube-dl.override {
  ffmpegSupport = false;
  rtmpSupport = false;
  hlsEncryptedSupport = false;
}
$ nix path-info -S ./result/
/nix/store/dgpa0aam0dycfsaky86qaf32j8vdf6wn-python3.8-youtube-dl-2021.06.06-aarch64-unknown-linux-musl    161163952

So a closure size of ~153MiB without much optimisation. Obviously quite large for an Android app but not outlandish either; the official youtube app is >130MiB and the only optimisation done was to disable optional features in youtube-dl itself. Phones also have dozens of gigabytes of storage nowadays, so even a few hundred megs don't really hurt much.

Because of its size, youtube-dl should obviously have to live outside the NP package somehow. Downloading it at runtime would be an easy way but that sounds unclean, potentially dangerous and has a lot of overhead.
I'm not very well versed in Android IPC and the like but perhaps it could be spun into a separate app package? That way the URL youtube-dl supports could also be delegated to that package.
(Maybe the whole extractor could be like that anyways so that it's pluggable and the youtube-dl-based extractor would be a totally separate one?)

I'd really like to know what you all think of this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed Nix youtube-dl build and the referenced mpv-android PR 58, then inspect how the extractor could be separated from the Android package. Done would require an agreed integration and distribution approach that addresses IPC, supported URLs, and the approximately 153 MiB build size.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, python
Domain
backend, mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.