chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 581 forks source link

Douyutv error #1411

Open bupmc opened 8 years ago

bupmc commented 8 years ago

Windows nightly build was working fine until hours ago: URL: www.douyutv.com/321358 error: Unable to validate JSON: Unable to validate key 'data': u'api\u8eab\u4efd \u4fe1\u606f\u9519\u8bef' does not equal None or Type of u'api\u8eab\u4efd\u4fe1 \u606f\u9519\u8bef' should be 'dict' but is 'unicode'

dojima commented 8 years ago

Same.

ChaosTong commented 8 years ago

the api have been changed so....

steven7851 commented 8 years ago

1414

dojima commented 8 years ago

Thanks for the fix, steven. It seems to work with the majority of streams, specifically the ones that use a six digit number for the user URL, but it's not working for me in the streams that don't follow this format.

For example, douyu.com/chtmac produces the following error:

error: Unable to open URL: http://www.douyu.com/lapi/live/getPlay/chtmac (403 Cl ient Error: Forbidden)

steven7851 commented 8 years ago

@dojima I have tried to fix, see my PR and feedback if get error again.

bupmc commented 8 years ago

现在人气高的直播间Available streams只剩source,以前人气高的直播间Available streams还有一个middle可选,请问还能和以前一样吗?

steven7851 commented 8 years ago

@bupmc 谢谢你的建议 新增了画质选择, source = 超清, middle = 高清, low = 普清 选择高清或普清时, 若直播间人数不足, api 还是返回超清串流

dojima commented 8 years ago

@steven7851 Works flawlessly. Thanks a bunch.

bupmc commented 8 years ago

Thanks a lot!

xingchch commented 8 years ago

现在斗鱼应该改版了,域名改成www.douyu.com,

livestreamer -l debug http://www.douyu.com/692053 worst error: No plugin can handle URL: http://www.douyu.com/692053

如果把域名改成www.douyutv.com,会有以下错误:

livestreamer -l debug http://www.douyutv.com/692053 worst [cli][info] Found matching plugin douyutv for URL http://www.douyutv.com/692053 [cli][info] Available streams: source (worst, best) [cli][info] Opening stream: source (http) [cli][error] Could not open stream: Unable to open URL: http://hdl1a.douyutv.com/live/ (403 Client Error: Forbidden)

dojima commented 8 years ago

Yeah, I had that issue when douyutv.com first started redirecting to douyu.com. To fix it, I just made a copy of douyutv.py in the plugins directory and renamed it as douyu.py, then changed every instance of 'douyutv' inside the file to 'douyu'. There should be two mentions that need to be replaced. After that, just save the file, and it should work fine.

steven7851 commented 8 years ago

@xingchch @dojima The code is compatible with "douyu.com" and "douyutv.com". 403 error is caused by lapi returning wrong stream URL. I think that it's because channel just start recently. (or else. Just my guess.) The only way is waiting for a while until stream URL is generated.

ximellon commented 8 years ago

@steven7851 I've tried your patch. It's awesome! Thanks a lot. But I also found a problem for rooms of non-digit room ID. And I fix it. Here the code is. The problem only exists for rooms that have particular pages for promotion, like LPL, Blizzard, etc. I did this only for LPL channel and haven't tested a lot for other cases. Feel free to use it and report any problems that you encounter!

steven7851 commented 8 years ago

Thanks for your work. I find the code problem: When in a event page, it exists many "data-room_id=". Livestreamer doesn't have list moudle, so there is no method to handle that. It will pick the first data-room_id as channel.

exp. http://www.douyu.com/cms/zt/lpl.html

<a class="cur" href="javascript:;" data-owner_name="Riot赛事直播" data-room_name="LPL春季赛30日比赛重播" data-room_id="288016" data-owner_uid="19344409"> <b></b> 
<h3>主房间</h3>
</a> <a href="javascript:;" data-owner_name="Riot赛事直播二" data-room_name="LPL春季赛30日比赛重播" data-room_id="424559" data-owner_uid="19344409"> <b></b> 
<h3>副房间</h3>

Or you can try another project like ykdl which has list moudle.

bnlou9 commented 8 years ago

@steven7851 請教該怎麼使用/下載您所提供的檔案/code?

steven7851 commented 8 years ago

@bnlou9 Download the raw file and copy to livestreamer\plugins with replacing the old one.

bnlou9 commented 8 years ago

@steven7851 thank you very much

bupmc commented 7 years ago

这里可以参考 https://github.com/spacemeowx2/DouyuHTML5Player/commit/97c72a8f4e63f9b17c176d9c36d4841b5951e478

各位高手有时间受累看看,2月28斗鱼改版后: [cli][info] Found matching plugin douyutv for URL www.douyu.com/17732 error: Unable to open URL: https://www.douyu.com/lapi/live/getPlay/17732 (403 C lient Error: Forbidden)