LifeActor / ykdl

a video downloader focus on China mainland video sites.(一款专注于中国大陆视频网站的视频下载器。)
https://github.com/LifeActor/ykdl
Other
1.45k stars 285 forks source link

虎牙 wrong url string #635

Open yoyosnart opened 8 months ago

yoyosnart commented 8 months ago

在提交前,请确保您已经检查了以下内容!

请将错误输出粘贴在下面:

ykdl https://www.huya.com/139258 D:\
site:                 Huya Live (虎牙直播)
title:                「小草包QAQ - 虎牙法王教你如何掌控局势!」
artist:               小草包QAQ
streams:
    - format:         BD8M
      container:      flv
      profile:        蓝光8M
    # download-with:  ykdl --format=BD8M [URL]

Now downloading: 「小草包QAQ - 虎牙法王教你如何掌控局势!」_BD8M_2024-03-13T06꞉58꞉33.flv
WARNING:ykdl.util.external:
=================================
  stop downloading by press 'q'
=================================

[http @ 000001efb499d240] HTTP error 403 Forbidden
http://hw.flv.huya.com/src/9813168-9813168-42147235630153728-19749792-10057-A-0-1-imgplus.flv?wsSecret=661e717859002cf90a4b788812ce97df&wsTime=65f0dd94&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,: Server returned 403 Forbidden (access denied)
WARNING:ykdl.common:> url not starts with http(s) D:\
WARNING:ykdl.common:> assume http connection!
CRITICAL:YKDL:ykdl https://www.huya.com/139258 D:\ --debug
DEBUG:ykdl.util.http:Add <urllib.request.HTTPSHandler object at 0x00000253698A9A90> to default handlers
DEBUG:ykdl.util.http:Add <urllib.request.ProxyHandler object at 0x00000253698A9910> to default handlers
DEBUG:ykdl.common:host> www.huya.com
DEBUG:ykdl.common:short_name> huya
DEBUG:ykdl.util.http:get_response> URL: https://www.huya.com/139258
DEBUG:Huya Live (虎牙直播):data:
{"data":[{"gameLiveInfo":{"uid":9813168,"sex":1,"gameFullName":"英雄联盟","gameHostName":"lol","startTime":1710249584,"activityId":0,"level":23,"totalCount":1343343,"roomName":"","isSecret":0,"cameraOpen":0,"liveChannel":9813168,"bussType":1,"yyid":8883007,"screenshot":"http://live-cover.msstatic.com/huyalive/9813168-9813168-42147235630153728-19749792-10057-A-0-1-imgplus/20240313070803.jpg","activityCount":64084,"privateHost":"8883007","recommendStatus":0,"nick":"小草包QAQ","shortChannel":0,"avatar180":"https://huyaimg.msstatic.com/avatar/1027/cb/695ef6b23a59e1009418455d1f01eb_180_135.jpg?1706484666","gid":1,"channel":9813168,"introduction":"虎牙法王教你如何掌控局势!","profileHomeHost":"8883007","liveSourceType":0,"screenType":1,"bitRate":8000,"gameType":0,"attendeeCount":1343343,"multiStreamFlag":521,"codecType":0,"liveCompatibleFlag":0,"profileRoom":139258,"liveId":"7345466029166865996","recommendTagName":"","contentIntro":""},"gameStreamInfoList":[{"sCdnType":"AL","iIsMaster":0,"lChannelId":9813168,"lSubChannelId":9813168,"lPresenterUid":9813168,"sStreamName":"9813168-9813168-42147235630153728-19749792-10057-A-0-1-imgplus","sFlvUrl":"http://al.flv.huya.com/src","sFlvUrlSuffix":"flv","sFlvAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","sHlsUrl":"http://al.hls.huya.com/src","sHlsUrlSuffix":"m3u8","sHlsAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","iLineIndex":3,"iIsMultiStream":1,"iPCPriorityRate":-1,"iWebPriorityRate":-1,"iMobilePriorityRate":-1,"vFlvIPList":{"_proto":{"_classname":"string"},"_bValue":0,"value":[],"_classname":"list<string>"},"iIsP2PSupport":2,"sP2pUrl":"http://al.p2p.huya.com/huyalive","sP2pUrlSuffix":"slice","sP2pAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","lFreeFlag":2,"iIsHEVCSupport":0,"vP2pIPList":{"_proto":{"_classname":"string"},"_bValue":0,"value":[],"_classname":"list<string>"},"mpExtArgs":{"_kproto":{"_classname":"string"},"_vproto":{"_classname":"string"},"_bKey":0,"_bValue":0,"value":{},"_classname":"map<string,string>"},"lTimespan":"15386033033","_classname":"HUYA.StreamInfo"},{"sCdnType":"TX","iIsMaster":0,"lChannelId":9813168,"lSubChannelId":9813168,"lPresenterUid":9813168,"sStreamName":"9813168-9813168-42147235630153728-19749792-10057-A-0-1-imgplus","sFlvUrl":"http://tx.flv.huya.com/src","sFlvUrlSuffix":"flv","sFlvAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","sHlsUrl":"http://tx.hls.huya.com/src","sHlsUrlSuffix":"m3u8","sHlsAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","iLineIndex":5,"iIsMultiStream":1,"iPCPriorityRate":100,"iWebPriorityRate":100,"iMobilePriorityRate":100,"vFlvIPList":{"_proto":{"_classname":"string"},"_bValue":0,"value":[],"_classname":"list<string>"},"iIsP2PSupport":2,"sP2pUrl":"http://tx.p2p.huya.com/huyalive","sP2pUrlSuffix":"slice","sP2pAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","lFreeFlag":1,"iIsHEVCSupport":0,"vP2pIPList":{"_proto":{"_classname":"string"},"_bValue":0,"value":[],"_classname":"list<string>"},"mpExtArgs":{"_kproto":{"_classname":"string"},"_vproto":{"_classname":"string"},"_bKey":0,"_bValue":0,"value":{},"_classname":"map<string,string>"},"lTimespan":"15386033033","_classname":"HUYA.StreamInfo"},{"sCdnType":"HW","iIsMaster":0,"lChannelId":9813168,"lSubChannelId":9813168,"lPresenterUid":9813168,"sStreamName":"9813168-9813168-42147235630153728-19749792-10057-A-0-1-imgplus","sFlvUrl":"http://hw.flv.huya.com/src","sFlvUrlSuffix":"flv","sFlvAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","sHlsUrl":"http://hw.hls.huya.com/src","sHlsUrlSuffix":"m3u8","sHlsAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","iLineIndex":6,"iIsMultiStream":1,"iPCPriorityRate":0,"iWebPriorityRate":0,"iMobilePriorityRate":0,"vFlvIPList":{"_proto":{"_classname":"string"},"_bValue":0,"value":[],"_classname":"list<string>"},"iIsP2PSupport":2,"sP2pUrl":"http://hw.p2p.huya.com/huyalive","sP2pUrlSuffix":"slice","sP2pAntiCode":"wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,","lFreeFlag":0,"iIsHEVCSupport":0,"vP2pIPList":{"_proto":{"_classname":"string"},"_bValue":0,"value":[],"_classname":"list<string>"},"mpExtArgs":{"_kproto":{"_classname":"string"},"_vproto":{"_classname":"string"},"_bKey":0,"_bValue":0,"value":{},"_classname":"map<string,string>"},"lTimespan":"15386033033","_classname":"HUYA.StreamInfo"}]}],"count":0,"vMultiStreamInfo":[{"sDisplayName":"蓝光8M","iBitRate":0,"iCodecType":0,"iCompatibleFlag":0,"iHEVCBitRate":-1,"_classname":"LiveRoom.LiveBitRateInfo"},{"sDisplayName":"蓝光4M","iBitRate":4000,"iCodecType":0,"iCompatibleFlag":0,"iHEVCBitRate":4000,"_classname":"LiveRoom.LiveBitRateInfo"},{"sDisplayName":"超清","iBitRate":2000,"iCodecType":0,"iCompatibleFlag":0,"iHEVCBitRate":2000,"_classname":"LiveRoom.LiveBitRateInfo"},{"sDisplayName":"流畅","iBitRate":500,"iCodecType":0,"iCompatibleFlag":0,"iHEVCBitRate":500,"_classname":"LiveRoom.LiveBitRateInfo"}],"iWebDefaultBitRate":4000,"iFrameRate":60}
site:                 Huya Live (虎牙直播)
title:                「小草包QAQ - 虎牙法王教你如何掌控局势!」
artist:               小草包QAQ
streams:
    - format:         BD8M
      container:      flv
      profile:        蓝光8M
    # download-with:  ykdl --format=BD8M [URL]

Now downloading: 「小草包QAQ - 虎牙法王教你如何掌控局势!」_BD8M_2024-03-13T07꞉08꞉24.flv
WARNING:ykdl.util.external:
=================================
  stop downloading by press 'q'
=================================

[http @ 00000246b3c9d240] HTTP error 403 Forbidden
http://al.flv.huya.com/src/9813168-9813168-42147235630153728-19749792-10057-A-0-1-imgplus.flv?wsSecret=4d12ea4761946133224adbe508fca39b&wsTime=65f0e06c&fm=RFdxOEJjSjNoNkRKdDZUWV8kMF8kMV8kMl8kMw%3D%3D&ctype=huya_live&fs=bgct&sphdcdn=al_7-tx_3-js_3-ws_7-bd_2-hw_2&sphdDC=huya&sphd=264_*-265_*&exsphd=264_500,264_2000,264_4000,: Server returned 403 Forbidden (access denied)
WARNING:ykdl.common:> url not starts with http(s) D:\
WARNING:ykdl.common:> assume http connection!
CRITICAL:YKDL:wrong URL string!

如果你有其他附言,例如问题只在某个视频发生,或者是一般性讨论或者提出新功能,请在下面添加:

第一个问题是 url 解析出来后 结尾多了一个 '逗号' 导致 url错误

第二个问题是 即使手动将逗号去除 , 改为正确的url , 下载3秒就会断流

SeaHOH commented 7 months ago

错误提示 wrong URL string! 是针对命令中的第二部分 D:\,它被解析成网址,指定下载位置请使用 -o--output-dir

断流和无法下载的问题请更新到最新开发版本。 另外,可能的话也更新下 FFmpeg。

hmm5 commented 2 months ago

Huya 不能用了 每次就有"HTTP error 403 Forbidden". 不知道怎么该可是streamlink有一个fix.

https://github.com/streamlink/streamlink/commit/6d953efb7f9c2012c497f9f3059117c3bcfd07be

SeaHOH commented 2 months ago

'ctype': 'tars_mp' 改成 'ctype': 'huya_live' 试试,如果不是过于频繁下载导致 UA 被封,大概就是这个。

hmm5 commented 2 months ago

看起来改成'ctype': 'huya_live'能用了。现在没有问题了。谢谢。