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

rokfin: extract premium video url from timeline url #6507

Merged
merged 8 commits into from
Mar 11, 2023
Merged

rokfin: extract premium video url from timeline url #6507

merged 8 commits into from
Mar 11, 2023

Conversation

vampirefrog
Copy link
Contributor

Play rokfin premium videos for free

The Rokfin JSON endpoint (https://prod-api-v2.production.rokfin.com/api/v2/public/(post|stream)/XXXXX) for video info serves the timeline URL unconditionally, but the video URL conditionally, depending on whether you are authenticated as a premium user or not. We can extract the video URL by doing some regexp replaces on the timeline URL, and get free premium videos.

JSON examples:

Regular post:

{
    ...
    "content": {
        "contentUrl": "https://stream.v.rokfin.com/6Zd5jkqFqdjPtjsPR9yyfBhqMpFQTjBUuyw3TTQ3bt8.m3u8",
        "timelineUrl": "https://image.v.rokfin.com/6Zd5jkqFqdjPtjsPR9yyfBhqMpFQTjBUuyw3TTQ3bt8/storyboard.vtt",
        ...
    },
    ...
    "premiumPlan": 0,
    ...
}

Premium post:

{
    ...
    "content": {
        "contentUrl": "fake.m3u8",
        "timelineUrl": "https://image.v.rokfin.com/RyuU3qO5zCtpJVW0100kz4dQRQ8TLOzcj7ciPw3Ks6Eus/storyboard.vtt"
        ...
    },
    ...
    "premiumPlan": 1,
    ...
}

Regular stream:

{
    ...
    "premium": false,
    "timelineUrl": "https://image.v.rokfin.com/dskqq02c1CI01mrjxhFXK001lC8wVwtCldLvVzV8kKaq01c/storyboard.vtt",
    "url": "https://stream.v.rokfin.com/dskqq02c1CI01mrjxhFXK001lC8wVwtCldLvVzV8kKaq01c.m3u8",
    ...
}

Premium stream:

{
    ...
    "premium": true,
    "timelineUrl": "https://image.v.rokfin.com/XhgU6OrjLD02URB7643jCPAzjvzpEk02qKbmxRneG58Ns/storyboard.vtt",
    "url": "",
    ...
}
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?

allows playing premium videos for free
@vampirefrog
Copy link
Contributor Author

for posts, they also have a gif URL which also contains the random string that can be used to generate the video URL

@vampirefrog
Copy link
Contributor Author

looks fine to me, tried with a stream and a post

@pukkandan
Copy link
Member

Would it be possible to add a test?

yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
yt_dlp/extractor/rokfin.py Outdated Show resolved Hide resolved
@pukkandan pukkandan merged commit 7a6c8a0 into yt-dlp:master Mar 11, 2023
elyse0 pushed a commit to elyse0/yt-dlp that referenced this pull request Mar 12, 2023
@vampirefrog vampirefrog deleted the rokfin-fake-premium branch March 13, 2023 17:30
qa4FKm3mUr added a commit to qa4FKm3mUr/yt-dlp that referenced this pull request Jul 30, 2023
* [utils] Add hackish 'now' support for --download-sections

* [utils] Add microseconds to unified_timestamp

* [common] Extract start and end keys for Dash fragments

* [utils] Allow using local timezone for 'now' timestamps

* Use local timezone for download sections

* Add fixme in modified parse_chapters function

A range like '*(now-1hour)-(now-30minutes)' doesn't work

* [youtube] Support --download-sections for YT Livestream from start

* Create last_segment_url only if necessary

* Improve parse_chapters comments

* Fix linter

* [extractor/iq] Set more language codes (yt-dlp#6476)

Authored by: D0LLYNH0

* [extractor/opencast] Add ltitools to `_VALID_URL` (yt-dlp#6371)

Authored by: C0D3D3V

* [downloader/curl] Fix progress reporting

Bug in 8c53322
Closes yt-dlp#6490

* [extractor/youtube] Bypass throttling for `-f17`

and related cleanup

Thanks @AudricV for the finding

* [extractor/twitch] Fix `is_live` (yt-dlp#6500)

Closes yt-dlp#6494
Authored by: elyse0

* [extractor/cbc:gem] Update `_VALID_URL` (yt-dlp#6499)

Authored by: makeworld-the-better-one
Closes yt-dlp#6395

* Support loading info.json with a list at it's root

* [extractor/hidive] Fix login

Fixes yt-dlp#6493 (comment)

* [extractor/opencast] Fix format bug (yt-dlp#6512)

Authored by: C0D3D3V

* [extractor/rokfin] Re-construct manifest url (yt-dlp#6507)

Authored by: vampirefrog

* [extractor/youtube] Add client name to `format_note` when `-v` (yt-dlp#6254)

Authored by: Lesmiscore, pukkandan

* [extractor/youtube] Add extractor-arg `include_duplicate_formats`

* [extractor/youtube] Construct fragment list lazily

Building fragment list for all formats take significant time for large videos

* Support negative durations

* Revert "[utils] Allow using local timezone for 'now' timestamps"

This reverts commit 1799a6a.

* Add fragment count

* Fix unified_timestamp

* Remove tz_aware date code

* Add debug for selected section

* Add initial documentation

* Fix linter

* Fix linter

* Allow days in parse_duration

* Improve option documentation

* Add some documentation

* Lock less agressively

This gives a speed performance of about 30%

* Fix return values of _extract_sequence_from_mpd

* Always compute last_seq

* Support for epoch timestamps

* Update options docs

* Restore README.md

I think this is auto-generated by some script

* Add warning about --download-sections without --live-from-start

* Fix bug after merge

* Update yt_dlp/options.py

* Cleanup

---------

Co-authored-by: Elyse <[email protected]>
Co-authored-by: Sophire <[email protected]>
Co-authored-by: D0LLYNH0 <[email protected]>
Co-authored-by: Daniel Vogt <[email protected]>
Co-authored-by: pukkandan <[email protected]>
Co-authored-by: makeworld <[email protected]>
Co-authored-by: Daniel Vogt <[email protected]>
Co-authored-by: vampirefrog <[email protected]>
Co-authored-by: Lesmiscore <[email protected]>
Co-authored-by: bashonly <[email protected]>
Co-authored-by: bashonly <[email protected]>
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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants