Thanks to visit codestin.com
Credit goes to github.com

Skip to content

plugins.huya: fix stream URLs#5785

Merged
bastimeyer merged 1 commit into
streamlink:masterfrom
bastimeyer:plugins/huya/5784
Jan 19, 2024
Merged

plugins.huya: fix stream URLs#5785
bastimeyer merged 1 commit into
streamlink:masterfrom
bastimeyer:plugins/huya/5784

Conversation

@bastimeyer

Copy link
Copy Markdown
Member

Set Referer and Origin headers, keep only necessary query string params in the stream URLs, and remove stream URL HEAD request.


Fixes #5784

No idea if this is valid for all channels.

Random channel test:

for cdn in $(streamlink --json huya.com/shege | jq -r '.streams | keys[] | select(contains("source_"))'); do
    timeout 20 streamlink -o /dev/null huya.com/shege $cdn
    echo
done
[cli][info] Found matching plugin huya for URL huya.com/shege
[cli][info] Available streams: source_hs (worst), source_al, source_hw, source_tx (best)
[cli][info] Opening stream: source_al (http)
[cli][info] Writing output to
/dev/null
[download] Written 6.42 MiB to /dev/null (16s @ 411.13 KiB/s)                                                                                   
[cli][info] Stream ended
Interrupted! Exiting...
[cli][info] Closing currently open stream...

[cli][info] Found matching plugin huya for URL huya.com/shege
[cli][info] Available streams: source_hs (worst), source_al, source_hw, source_tx (best)
[cli][info] Opening stream: source_hs (http)
[cli][info] Writing output to
/dev/null
[download] Written 8.28 MiB to /dev/null (15s @ 555.56 KiB/s)                                                                                   
[cli][info] Stream ended
Interrupted! Exiting...
[cli][info] Closing currently open stream...

[cli][info] Found matching plugin huya for URL huya.com/shege
[cli][info] Available streams: source_hs (worst), source_al, source_hw, source_tx (best)
[cli][info] Opening stream: source_hw (http)
[cli][info] Writing output to
/dev/null
[download] Written 6.49 MiB to /dev/null (15s @ 435.55 KiB/s)                                                                                   
[cli][info] Stream ended
Interrupted! Exiting...
[cli][info] Closing currently open stream...

[cli][info] Found matching plugin huya for URL huya.com/shege
[cli][info] Available streams: source_hs (worst), source_al, source_hw, source_tx (best)
[cli][info] Opening stream: source_tx (http)
[cli][info] Writing output to
/dev/null
[download] Written 10.32 MiB to /dev/null (16s @ 670.37 KiB/s)                                                                                  
[cli][info] Stream ended
Interrupted! Exiting...
[cli][info] Closing currently open stream...

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Jan 18, 2024
- set Referer and Origin headers
- only keep the `wsSecret` and `wsTime` query string params
  in the stream URLs
- remove stream URL HEAD requests for checking the availability
- add stream priority override for faulty TLS server configs
@bastimeyer

Copy link
Copy Markdown
Member Author

Did another check and apparently there's a TLS/SSL issue on one of their CDNs (source_hy). I've added a stream priority override, so it's not listed as "best".

Going to merge now...

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

$ streamlink https://www.huya.com/52009 source_hy
[cli][info] Found matching plugin huya for URL https://www.huya.com/52009
[cli][info] Available streams: source_hy (worst), source_tx, source_hw, source_al (best)
[cli][info] Opening stream: source_hy (http)
[cli][info] Starting player: /usr/bin/mpv
[cli][error] Try 1/1: Could not open stream <HTTPStream ['http', 'https://qvodlive-va.huya.com/src/2364556832-2364556832-10155694262973366272-4729237120-10057-A-0-1-imgplus.flv?wsSecret=148cbf4b31cf839c4afba142def518af&wsTime=65aa47cf']> (Could not open stream: Unable to open URL: https://qvodlive-va.huya.com/src/2364556832-2364556832-10155694262973366272-4729237120-10057-A-0-1-imgplus.flv?wsSecret=148cbf4b31cf839c4afba142def518af&wsTime=65aa47cf (HTTPSConnectionPool(host='205642298-server.va.huya.com', port=20603): Max retries exceeded with url: /qvodlive-va.huya.com/src/2364556832-2364556832-10155694262973366272-4729237120-10057-A-0-1-imgplus.flv?wsSecret=148cbf4b31cf839c4afba142def518af&wsTime=65aa47cf&p_iaas=1&streamname=2364556832-2364556832-10155694262973366272-4729237120-10057-A-0-1-imgplus&appid=66&ctskey=16428384312371249286 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))))
error: Could not open stream <HTTPStream ['http', 'https://qvodlive-va.huya.com/src/2364556832-2364556832-10155694262973366272-4729237120-10057-A-0-1-imgplus.flv?wsSecret=148cbf4b31cf839c4afba142def518af&wsTime=65aa47cf']>, tried 1 times, exiting

@bastimeyer bastimeyer merged commit 91cd146 into streamlink:master Jan 19, 2024
@bastimeyer bastimeyer deleted the plugins/huya/5784 branch January 19, 2024 10:01
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.

plugins.huya: 403 Client Error: Forbidden for url

1 participant