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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various radiko enhancements #8221

Merged
merged 10 commits into from Oct 6, 2023
Merged

Conversation

garret1317
Copy link
Collaborator

@garret1317 garret1317 commented Sep 28, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

These patches improve the radiko extractor using things I've learnt while developing my plugin yt-dlp-rajiko.
Hopefully the commit messages explain each change well enough, feel free to ask if not.

e9117f0 sort-of-fixes #6090, since the new format downloads with yt-dlp's hls downloader rather than ffmpeg.
However it could possibly break someone's workflow, as the extractor now extracts completely different formats. This commit can be skipped if you'd like.

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:

  • 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?

Copilot Summary

馃 Generated by Copilot at e9117f0

Summary

馃寪馃晵馃攽

Enhance the radiko.py extractor to handle different types of streams, check geo-restrictions, and streamline the code.

Radiko is the sound of doom, the voice of the oppressed
We break the chains of geo-restriction, we stream the timefree past
We simplify the code of darkness, we decrypt the hidden light
We fix the flaws of format extraction, we make the metadata right

Walkthrough

  • Disable geo-bypass and raise error for out-of-Japan users (link, link)
  • Rename and move _auth_client method to _negotiate_token (link)
  • Use different XML endpoint and filter URLs by timefree attribute for live and timefree streams (link, link)
  • Generate random lsid parameter for playlist URL (link, link)
  • Remove live argument from _extract_m3u8_formats method call (link)
  • Simplify token and area ID extraction and return formats early (link, link)
  • Add comment to clarify hardcoded full key fallback (link)
  • Change is_live key to live_status and set it to was_live for timefree streams (link)

lsid is an ID. Currently all yt-dlp users talk to the stream apis as the
same person. this commit generates a random id with secrets.token_hex()
instead.
This filters for streams that match the onair status of the current
download
i'm not really sure what the bottom stuff does so i've left it alone
only for outside japan, not for prefecture-level
there's an api for this, we don't have to blindly try and download twice
this API seemingly always gives "happy path" streams:
The live streams work perfectly fine with ffmpeg.
The catch-up isn't streamed as-live, it's regular non-live hls that
works with yt-dlp's hls downloader (though annoyingly not with mpv).
@garret1317 garret1317 added geo-blocked Content is geo-blocked site-enhancement Feature request for some website labels Sep 28, 2023
@garret1317
Copy link
Collaborator Author

actually yes do skip e9117f0
pc_html5 api does actually return the not-live streams, its just a matter of prioritising them over the live ones

@bashonly bashonly self-requested a review September 28, 2023 15:12
yt_dlp/extractor/radiko.py Outdated Show resolved Hide resolved
yt_dlp/extractor/radiko.py Outdated Show resolved Hide resolved
yt_dlp/extractor/radiko.py Outdated Show resolved Hide resolved
yt_dlp/extractor/radiko.py Outdated Show resolved Hide resolved
yt_dlp/extractor/radiko.py Outdated Show resolved Hide resolved
@bashonly bashonly added the pending-fixes PR has had changes requested label Oct 3, 2023
garret1317 and others added 2 commits October 3, 2023 17:02
Co-Authored-By: bashonly <bashonly@bashonly.com>
@garret1317
Copy link
Collaborator Author

oh bugger ive broken the indentation

@bashonly bashonly removed the pending-fixes PR has had changes requested label Oct 3, 2023
@bashonly bashonly added the pending-review PR needs a review label Oct 3, 2023
@Grub4K Grub4K removed the pending-review PR needs a review label Oct 5, 2023
@bashonly bashonly merged commit 2ad3873 into yt-dlp:master Oct 6, 2023
16 checks passed
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
geo-blocked Content is geo-blocked site-enhancement Feature request for some website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken site: radiko.jp: Invalid data found when processing input
3 participants