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

Viki Wrong Subtitle Timestamp on some videos #26385

Open
zackmark29 opened this issue Aug 20, 2020 · 5 comments
Open

Viki Wrong Subtitle Timestamp on some videos #26385

zackmark29 opened this issue Aug 20, 2020 · 5 comments

Comments

@zackmark29
Copy link

@zackmark29 zackmark29 commented Aug 20, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.07.28
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

PASTE VERBOSE LOG HERE

Description

If you try to get the english subtitle from this link, https://www.viki.com/videos/91001v-dream-high-episode-1
you will get the result (take note of the ts):
WEBVTT
1
00:00:07.034 --> 00:00:11.013
Right now, fans are in attendance at the L.A. Staples Center

The timestamp must be like this:
WEBVTT
1
00:00:00.824 --> 00:00:04.803
Right now, fans are in attendance at the L.A. Staples Center

@blackjack4494
Copy link

@blackjack4494 blackjack4494 commented Aug 20, 2020

Like I said here there is missing something. After few minutes of trying different things I noticed all you need is to add a stream_id. The stream_id can be obtained from /v4/videos/VIDEO/streams.json so far all ids (didn't test the mpd tho) will give the fixed / right timestamped subtitles.
While playing around with that I also noticed that the mpd returned by the api is different from the one in the browser.

Browser
https://manifest-viki.viki.io/v1/91001v/akamai/main/mpd/normal/viki/high/mpdhd/non_kcp/na/manifest.mpd?
Api
https://manifest-viki.viki.io/v1/91001v/akamai/domain_4/mpd/normal/viki/high/mpd_mob/non_kcp/na/manifest.mpd?

The one returned by browser will contain 1080p while api will cap at 720p even if logged in. However it's not that easy (so far) to get the browser one. It will require reverse engineering / debugging the js file that triggers that request.

So for the subtitles regarding the example video given you would need this videos/91001v/subtitles/en.vtt?stream_id=94944602 (the id is the one pointing to the 360p version). Best practice would be to use the first id returned of streams.json or of the 360/480 version.
{"360p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_360p_d146ae_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944602","bumper_duration":0}},"1080p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_1080p_9c961d_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944608","bumper_duration":0}},"480p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_480p_b1d67f_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944617","bumper_duration":0}},"720p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_720p_a116d5_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944611","bumper_duration":0}},"mpd":{"http":{"url":"https://manifest-viki.viki.io/v1/91001v/akamai/domain_4/mpd/normal/viki/high/mpdhd_mob/non_kcp/na/manifest.mpd?app=100005a&tag=mpdhd_mob:high:non_kcp:sourceVIKI:mpd:cached&","cdn":"akamai","drms":[],"id":"94944622","bumper_duration":0}}}

I forgot to mention. The same issue (400/404) that my PR fixes applies to the subtitles.
https://api.viki.io/v4/videos/91001v/subtitles/en.vtt?stream_id=94944611&app=100005a& link.
<Response [400]> response. But the response isn't 400 actually. The link will return the vtt and its content correctly.

@zackmark29
Copy link
Author

@zackmark29 zackmark29 commented Aug 20, 2020

Like I said here there is missing something. After few minutes of trying different things I noticed all you need is to add a stream_id. The stream_id can be obtained from /v4/videos/VIDEO/streams.json so far all ids (didn't test the mpd tho) will give the fixed / right timestamped subtitles.
While playing around with that I also noticed that the mpd returned by the api is different from the one in the browser.

Browser
https://manifest-viki.viki.io/v1/91001v/akamai/main/mpd/normal/viki/high/mpdhd/non_kcp/na/manifest.mpd?
Api
https://manifest-viki.viki.io/v1/91001v/akamai/domain_4/mpd/normal/viki/high/mpd_mob/non_kcp/na/manifest.mpd?

The one returned by browser will contain 1080p while api will cap at 720p even if logged in. However it's not that easy (so far) to get the browser one. It will require reverse engineering / debugging the js file that triggers that request.

So for the subtitles regarding the example video given you would need this videos/91001v/subtitles/en.vtt?stream_id=94944602 (the id is the one pointing to the 360p version). Best practice would be to use the first id returned of streams.json or of the 360/480 version.
{"360p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_360p_d146ae_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944602","bumper_duration":0}},"1080p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_1080p_9c961d_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944608","bumper_duration":0}},"480p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_480p_b1d67f_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944617","bumper_duration":0}},"720p":{"https":{"url":"https://v4.viki.io/91001v/91001v_high_720p_a116d5_1908070957.mp4?","seek":"ms","cdn":"limelight","id":"94944611","bumper_duration":0}},"mpd":{"http":{"url":"https://manifest-viki.viki.io/v1/91001v/akamai/domain_4/mpd/normal/viki/high/mpdhd_mob/non_kcp/na/manifest.mpd?app=100005a&tag=mpdhd_mob:high:non_kcp:sourceVIKI:mpd:cached&","cdn":"akamai","drms":[],"id":"94944622","bumper_duration":0}}}

I forgot to mention. The same issue (400/404) that my PR fixes applies to the subtitles.
https://api.viki.io/v4/videos/91001v/subtitles/en.vtt?stream_id=94944611&app=100005a& link.
<Response [400]> response. But the response isn't 400 actually. The link will return the vtt and its content correctly.

Wow I think is what I'm looking for. I'm gonna test this later and I will update you.

@zackmark29
Copy link
Author

@zackmark29 zackmark29 commented Aug 20, 2020

@blackjack4494 alright I get it now.
I found where the right subtitle. It's from "streamSubtitles" json object

image

The little bug from youtube-dl for not getting the right subtitle is. It's getting the subtitle link from "subtitle" json object
image

@blackjack4494
Copy link

@blackjack4494 blackjack4494 commented Aug 28, 2020

@zackmark29 I assume the json you got is custom made by your own program?

@zackmark29
Copy link
Author

@zackmark29 zackmark29 commented Aug 30, 2020

@zackmark29 I assume the json you got is custom made by your own program?

@blackjack4494 no, it's from https://www.viki.com/api/videos/{video_id}
and required viki version as well

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.