Skip to content
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

[nebula] Add new extractor (Nebula / watchnebula.com) #27859

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

hheimbuerger
Copy link

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

(This is a post-DMCA repost of #24805 on a new fork. Read below for details.)

This is a new extractor for the video platform Nebula (https://watchnebula.com/), created by the streamer community Standard. Nebula uses the Zype video infrastructure and this extractor is using the url_transparent mode to hand off video extraction to the Zype extractor (which has shown to be super reliable here).

All videos on Nebula require a subscription to access. Multiple authentication methods are supported, with the most convenient probably being .netrc, but a few alternatives (cookie jar, environment variable, token in --videopassword) have been implemented as well.

Initial discussion has occured on issue #21258. I didn't open the issue, but hijacked it for my implementation.
Afterwards, development discussion has occured over multiple months on PR #24805. The fork that PR was based on has been destroyed by the DMCA takedown. According to GitHub Support, a transfer of that PR to a different fork is not possible, which is why I'm now opening this new PR for the new fork (original commits are the same).

As there are no known freely available videos, the three test cases only pass when an auth token to a user account with a (paid) subscription is present. This can be specified using the NEBULA_TOKEN environment variable (as I couldn't figure out a way to use --netrc in unit tests).

I have aimed to provide comprehensive documentation of approach and behavior in class and method docstrings.

When the 'sessionid' cookie is submitted to the `/auth/login/` endpoint,
the response is always a 403. This typically happens when youtube_dl is
run with both `--netrc` and `--cookies` as your default configuration.
In that situation, the first authentication succeeds and stores the
`sessionid` cookie in the cookie jar. During subsequent authentication
attempts, the cookie is sent alongside and causes the authentication to
fail.

This is very unexpected and we therefore specifically handle this case.
When Nebula isn't accessed for a while, the Zype access token stored on
the Nebula backend expires. It is then no longer returned by the user
endpoint.
The Nebula frontend has the same issue and keeps polling for the Zype
token in this case.
This isn't implemented in this extractor yet, but at least a specific
error message now prints some helpful advice.
@Xan-Kun
Copy link

Xan-Kun commented Jan 20, 2021

This is awesome! Thank you so much.

Copy link

@Skaronator Skaronator left a comment

Choose a reason for hiding this comment

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

Just tried this PR before my nebula account expired and it worked perfectly. (I was using the latest release and merged this PR manually in it)

@hheimbuerger
Copy link
Author

I should mention that I've simultaneously developed an extractor for the yt-dlp fork here: yt-dlp/yt-dlp#122

It has seen a couple of internal improvements. I could backport them to ytdl-org if you let me know there's some renewed interest. I just haven't bothered so far, because I assumed this PR to be dead in the water after almost a year of no activity.

@hheimbuerger
Copy link
Author

As of 2021-04-11, an improved fork of this PR has been released with yt-dlp.

Copy link
Contributor

@dirkf dirkf left a comment

Choose a reason for hiding this comment

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

Updating the PR code with back-port from its development in yt-dlp, with all non-subscriber tests passing, once Art19 extractor has been added.

docs/supportedsites.md Outdated Show resolved Hide resolved
youtube_dl/extractor/extractors.py Outdated Show resolved Hide resolved
youtube_dl/extractor/nebula.py Outdated Show resolved Hide resolved
And clean  up sorting
* somewhat like JSON.stringify()
* replaces json.dumps(..., separators=(',',':')).encode('utf-8')
* more kwarg options available
@dirkf
Copy link
Contributor

dirkf commented Nov 23, 2024

This should now be as up-to-date with yt-dlp as possible.

The account-needed functions need to be tested. Anyone with a Nebula account is invited to test the PR, disabling the 'skip': ... lines in the test-cases and, presumably, providing a netrc file for the tests.

@hheimbuerger
Copy link
Author

hheimbuerger commented Nov 25, 2024

Disclaimer: I'm not currently an active subscriber of Nebula and also haven't developed the latest version of the yt-dlp integration. (I did kickstart it and maintained it for a good while, though.)

One bit you might want to change is the _NETRC_MACHINE. yt-dlp uses the old Nebula domain of watchnebula as an ID to be backwards compatible from earlier versions of the integration. Given that you have no legacy base to support in youtube-dl, you could go straight away to the cleaner and more up-to-date nebula here.

@dirkf
Copy link
Contributor

dirkf commented Nov 25, 2024

Thanks for chiming in and for letting me [ab]use your PR branch!

.... Given that you have no legacy base to support in youtube-dl, you could go straight away to the cleaner and more up-to-date nebula here.

I would, but then people couldn't so easily switch between this extractor and the yt-dlp one. It's a half-empty/half-full situation.

@hheimbuerger
Copy link
Author

Thanks for chiming in and for letting me [ab]use your PR branch!

You're very welcome! I love that someone is still using the remnants of my dirty little hack. 😉

.... Given that you have no legacy base to support in youtube-dl, you could go straight away to the cleaner and more up-to-date nebula here.

I would, but then people couldn't so easily switch between this extractor and the yt-dlp one. It's a half-empty/half-full situation.

True. As usual, there's no right answer when it comes to compatibility.

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

Successfully merging this pull request may close these issues.

5 participants