streamlink / streamlink

Streamlink is a CLI utility which pipes video streams from various services into a video player
https://streamlink.github.io/
BSD 2-Clause "Simplified" License
10.12k stars 1.12k forks source link

plugins.huya: 403 Client Error: Forbidden for url #5784

Closed jumuzerg closed 10 months ago

jumuzerg commented 10 months ago

Checklist

Streamlink version

streamlink 6.5.1

Description

please forgive me, my english so bad and it's hard to understand all these rules, im newbie inpython, I don’t know, this has already been asked and I read the answer that this is not a streamlink problem, but maybe you can help me

Debug log

C:\Users\matebeats>streamlink.exe https://www.huya.com/sbwfz best
[cli][info] Found matching plugin huya for URL https://www.huya.com/sbwfz
[cli][info] Available streams: source_hw (worst, best)
[cli][info] Opening stream: source_hw (http)
[cli][info] Starting player: D:\matebeats\soft\media\VLC\vlc.exe
[cli][error] Try 1/1: Could not open stream <HTTPStream ['http', 'https://hw.flv.huya.com/src/70165683-70165683-301359313786503168-140454822-10057-A-0-1.flv?wsSecret=79ab95ca0c616135da585dba0e2373ef&wsTime=65a9468d&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct']> (Could not open stream: Unable to open URL: https://hw.flv.huya.com/src/70165683-70165683-301359313786503168-140454822-10057-A-0-1.flv?wsSecret=79ab95ca0c616135da585dba0e2373ef&wsTime=65a9468d&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct (403 Client Error: Forbidden for url: https://7b232e9a7ece13f936b4e19cb1594132.livehwc3.cn/hw.flv.huya.com/src/70165683-70165683-301359313786503168-140454822-10057-A-0-1.flv?cdn_redirect_domain=14769ccad573a2388a716f2ade587c96.livehwc3.cn&cdn_redirect=true&wsTime=65a9468d&ctype=huya_live&fs=bgct&policy=6&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&wsSecret=79ab95ca0c616135da585dba0e2373ef&cdn_redirect_tag=1705592487))
error: Could not open stream <HTTPStream ['http', 'https://hw.flv.huya.com/src/70165683-70165683-301359313786503168-140454822-10057-A-0-1.flv?wsSecret=79ab95ca0c616135da585dba0e2373ef&wsTime=65a9468d&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct']>, tried 1 times, exiting
jumuzerg commented 10 months ago

what should I do and where? im replace huya.py but its not work, then I manually deleted where the - was and inserted it where + the stream started for a second, test_huya.py I didn't find the streamlink in the directory, sorry again for my knowledge

bastimeyer commented 10 months ago

I manually deleted where the - was and inserted it where +

You were looking at the code diff format, which is not intended for you to copy and modify by hand.

Just download the full plugin file from here (the "raw" file link) and sideload it: https://raw.githubusercontent.com/bastimeyer/streamlink/plugins/huya/5784/src/streamlink/plugins/huya.py

More help here:

If you can, please provide feedback with a full debug log (--loglevel=debug), so we can see that you are correctly sideloading the new plugin. Please check if any streams on this site are not working, because as I said in the pull request, I am not sure if my changes are working on all live streams. Thank you.

jumuzerg commented 10 months ago

C:\Users\matebeats>streamlink.exe https://www.huya.com/18958992 best --loglevel=debug [cli][debug] OS: Windows 10 [cli][debug] Python: 3.8.10 [cli][debug] OpenSSL: OpenSSL 1.1.1k 25 Mar 2021 [cli][debug] Streamlink: 6.5.1 [cli][debug] Dependencies: [cli][debug] certifi: 2023.11.17 [cli][debug] isodate: 0.6.1 [cli][debug] lxml: 5.1.0 [cli][debug] pycountry: 23.12.11 [cli][debug] pycryptodome: 3.20.0 [cli][debug] PySocks: 1.7.1 [cli][debug] requests: 2.31.0 [cli][debug] trio: 0.24.0 [cli][debug] trio-websocket: 0.11.1 [cli][debug] typing-extensions: 4.9.0 [cli][debug] urllib3: 2.1.0 [cli][debug] websocket-client: 1.7.0 [cli][debug] Arguments: [cli][debug] url=https://www.huya.com/18958992 [cli][debug] stream=['best'] [cli][debug] --loglevel=debug [cli][debug] --player=D:\matebeats\soft\media\VLC\vlc.exe [cli][debug] --ffmpeg-ffmpeg=D:\matebeats\soft\network\streamlink-6.5.1-1-py312-x86_64\ffmpeg\ffmpeg.exe [cli][info] Found matching plugin huya for URL https://www.huya.com/18958992 [plugins.huya][debug] QUALITY_WEIGHTS: {'source_hw': -1} [cli][info] Available streams: source_hw (worst, best) [cli][info] Opening stream: source_hw (http) [cli][info] Starting player: D:\matebeats\soft\media\VLC\vlc.exe [cli][error] Try 1/1: Could not open stream <HTTPStream ['http', 'https://hw.flv.huya.com/src/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?wsSecret=ffcc67021d1b24be9c9f280f25f48325&wsTime=65aa84b8&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct']> (Could not open stream: Unable to open URL: https://hw.flv.huya.com/src/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?wsSecret=ffcc67021d1b24be9c9f280f25f48325&wsTime=65aa84b8&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct (403 Client Error: Forbidden for url: https://7b232e9a7ece13f936b4e19cb1594132.livehwc3.cn/hw.flv.huya.com/src/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?cdn_redirect=true&wsSecret=ffcc67021d1b24be9c9f280f25f48325&wsTime=65aa84b8&fs=bgct&policy=6&cdn_redirect_tag=1705673944&ctype=huya_live&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&cdn_redirect_domain=14769ccad573a2388a716f2ade587c96.livehwc3.cn)) error: Could not open stream <HTTPStream ['http', 'https://hw.flv.huya.com/src/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?wsSecret=ffcc67021d1b24be9c9f280f25f48325&wsTime=65aa84b8&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct']>, tried 1 times, exiting

jumuzerg commented 10 months ago

open please this, stream dont open today

bastimeyer commented 10 months ago

You are not using the updated plugin (which you can clearly see in the stream URL parameters). The plugin and this stream in particular is working fine, except for the source_hy CDN, which is broken on their end due to a bad TLS server configuration.

Either keep sideloading the updated plugin, or install Streamlink from the master branch. The next Windows nightly builds will contain the updated plugin, so wait for ~12 hours and install this build.

The Streamlink version must be this:

$ streamlink --version
streamlink 6.5.1+9.g91cd146c

$ for cdn in $(streamlink --json huya.com/18958992 | jq -r '.streams | keys[] | select(contains("source_"))'); do
    timeout 20 streamlink -o /dev/null huya.com/18958992 $cdn
    echo
done

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

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

[cli][info] Found matching plugin huya for URL huya.com/18958992
[cli][info] Available streams: source_hy (worst), source_tx, source_hw (best), source_al
[cli][info] Opening stream: source_hy (http)
[cli][info] Writing output to
/dev/null
[cli][error] Try 1/1: Could not open stream <HTTPStream ['http', 'https://qvodlive-va.huya.com/src/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?wsSecret=6a353c8c5b3848feaf19b4dbd236075e&wsTime=65aa8644']> (Could not open stream: Unable to open URL: https://qvodlive-va.huya.com/src/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?wsSecret=6a353c8c5b3848feaf19b4dbd236075e&wsTime=65aa8644 (HTTPSConnectionPool(host='888955316-server.va.huya.com', port=20604): Max retries exceeded with url: /qvodlive-va.huya.com/src/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?wsSecret=6a353c8c5b3848feaf19b4dbd236075e&wsTime=65aa8644&p_iaas=1&streamname=302994656-302994656-1301352138382770176-606112768-10057-A-0-1&appid=66&ctskey=11900172074328807777 (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/302994656-302994656-1301352138382770176-606112768-10057-A-0-1.flv?wsSecret=6a353c8c5b3848feaf19b4dbd236075e&wsTime=65aa8644']>, tried 1 times, exiting

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