Skip to content

Conversation

@bastimeyer
Copy link
Member

Closes #4848

This updates the API URL and adds the required request headers and timezone query string parameter.

As mentioned in #4848, the timezone query string parameter on the site is read from

Intl.DateTimeFormat().resolvedOptions().timeZone

which means it'll always be in the $Region/$City format. The plugin implementation however sets the timezone parameter to the UTC string, because it needs the UTC timezone for calculating the MD5 hash in the headers, which depends on the user's local time, and this needs to be calculated based on UTC. Otherwise, we'd need to get the timezone name from the user's local time, and that would require adding pytz as a dependency here, because the provided timezone parameter must match. I am not sure though how reliable setting the UTC timezone is, because as said, the site doesn't do this and they could very easily block such requests. Setting the timezone parameter to Europe/London doesn't work because of DST.

Either way, the plugin seems to be working now. I am also not sure about VOD content, but this wasn't supported prior to these changes, and I don't care about that one single bit.

Please double-check and test it yourself before merging.

$ streamlink https://www.thvli.vn/live/thvl1-hd best
[cli][info] Found matching plugin vinhlongtv for URL https://www.thvli.vn/live/thvl1-hd
[cli][info] Available streams: 480p (worst), 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls)
[cli][info] Starting player: mpv
[cli][info] Player closed
[cli][info] Stream ended
[cli][info] Closing currently open stream...

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Sep 25, 2022
@back-to back-to merged commit ee230e4 into streamlink:master Sep 25, 2022
@bastimeyer bastimeyer deleted the plugins/vinhlongtv/fix branch September 25, 2022 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin issue A Plugin does not work correctly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants