我的编程空间,编程开发者的网络收藏夹
学习永远不晚

一些斗鱼TV Web API [Some

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

一些斗鱼TV Web API [Some

 

去年TI5前开发了dotaonly.com,网站需要用到各个直播平台API。不像国外网站Twitch那样开放,都有现成的API可用,国内网站都很封闭,对开发者不太友好。本文所涉及API皆抓取自斗鱼IOS手机客户端。

获取当前全部直播

请求地址:
http://capi.douyucdn.cn/api/v1/live?limit=20&offset=0
参数:
limit: 一次获取的个数
offset:起始位置,比如要获取前20个之后的 offset=20, 下同
返回数据

{
    "error": 0,
    "data": [
        {
        "room_id": "16101",
        "room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/22/16/16101_160222165702.jpg",
        "cate_id": "1",
        "room_name": "微笑:  过节就应该带妹!",
        "show_status": "1",
        "subject": "",
        "show_time": "1456126421",
        "owner_uid": "391270",
        "specific_catalog": "weixiao",
        "specific_status": "1",
        "vod_quality": "0",
        "nickname": "微笑",
        "online": 1075780,
        "url": "/weixiao",
        "game_url": "/directory/game/LOL",
        "game_name": "英雄联盟",
        "child_id": "28",
        "fans": "936235"
        }
    ]
}
12345678910111213141516171819202122232425

获取父频道

请求地址:
http://capi.douyucdn.cn/api/v1/getColumnList
部分返回数据:

    {
        "error": 0,
        "data": [
            {
                "cate_id": "1",
                "cate_name": "游戏",
                "short_name": "game",
                "orderdisplay": "1",
                "is_relate": "1",
                "is_del": "0",
                "push_ios": "1",
                "push_show": "0"
            },
            {
                "cate_id": "9",
                "cate_name": "手机游戏",
                "short_name": "sjyx",
                "orderdisplay": "2",
                "is_relate": "1",
                "is_del": "0",
                "push_ios": "1",
                "push_show": "0"
            }
        ]
    }
12345678910111213141516171819202122232425

获取子频道

请求地址:
http://capi.douyucdn.cn/api/v1/getColumnDetail?shortName=game
参数:
shortName: 父频道名字,来自上一个请求返回数据中的short_name
部分返回数据:

{
    "error": 0,
    "data": [
        {
            "tag_id": "134",
            "short_name": "wsm",
            "tag_name": "玩数码",
            "pic_name": "7c855c7fa9c8c03697ee61748999d112.jpg",
            "icon_name": "a3f49c62bd6156b358a275a07a5b95dd.jpg",
            "orderdisplay": "126",
            "rank_score": "0",
            "night_rank_score": "0",
            "nums": "0",
            "push_ios": "1",
            "push_home": "1",
            "is_game_cate": "0",
            "cate_id": "3",
            "is_del": "0",
            "is_relate": "1",
            "pic_url": "/file/imgs/upload/202301/31/2elb0udvwgl.jpg",
            "url": "/directory/game/wsm",
            "icon_url": "/file/imgs/upload/202301/31/qsjhczusk5c.jpg",
            "count": 15,
            "count_ios": 8
        },
        {
            "tag_id": "136",
            "short_name": "car",
            "tag_name": "玩汽车",
            "pic_name": "6b83cf650fb4ba62881c9c528ab602d5.jpg",
            "icon_name": "ade2b45ee56831c3b100a436b8c2f624.jpg",
            "orderdisplay": "127",
            "rank_score": "0",
            "night_rank_score": "0",
            "nums": "0",
            "push_ios": "1",
            "push_home": "1",
            "is_game_cate": "0",
            "cate_id": "3",
            "is_del": "0",
            "is_relate": "1",
            "pic_url": "/file/imgs/upload/202301/31/uwftgttltl4.jpg",
            "url": "/directory/game/car",
            "icon_url": "/file/imgs/upload/202301/31/2gponogjh4f.jpg",
            "count": 4,
            "count_ios": 2
        }
    ]
}
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849

获取父频道所有直播列表

请求地址:
http://capi.douyucdn.cn/api/v1/getColumnRoom/<cate_id>?limit=20&offset=0
参数:
cate_id: 父频道id
limit
offset
返回数据:

{
    "error": 0,
    "data": [
        {
            "room_id": "536341",
            "room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/22/17/536341_160222172043.jpg",
            "cate_id": "134",
            "room_name": "22日晚5点30分MWC现场探馆看产品",
            "show_status": "1",
            "subject": "",
            "show_time": "1456132678",
            "owner_uid": "38598100",
            "specific_catalog": "",
            "specific_status": "0",
            "vod_quality": "0",
            "nickname": "ZOL中关村在线",
            "online": 1969,
            "child_id": "0"
        },
        {
            "room_id": "279558",
            "room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/22/17/279558_160222171918.jpg",
            "cate_id": "136",
            "room_name": "[24H斗鱼第一专业车评]陈震YYP选车",
            "show_status": "1",
            "subject": "",
            "show_time": "1455963983",
            "owner_uid": "18462494",
            "specific_catalog": "",
            "specific_status": "0",
            "vod_quality": "0",
            "nickname": "金叔2015",
            "online": 12304,
            "child_id": "0"
        }
    ]
}
12345678910111213141516171819202122232425262728293031323334353637

获取子频道直播列表

请求地址:
http://capi.douyucdn.cn/api/v1/live/<tag_id>?&limit=1&offset=0
参数:
tag_id: 子频道id
limit
offset
返回数据:

{
"error": 0,
"data": [
{
"room_id": "536341",
"room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/22/17/536341_160222172043.jpg",
"cate_id": "134",
"room_name": "22日晚5点30分MWC现场探馆看产品",
"show_status": "1",
"subject": "",
"show_time": "1456132678",
"owner_uid": "38598100",
"specific_catalog": "",
"specific_status": "0",
"vod_quality": "0",
"nickname": "ZOL中关村在线",
"online": 5700,
"url": "/536341",
"game_url": "/directory/game/wsm",
"game_name": "玩数码",
"child_id": "0",
"fans": "4084"
}
]
}
12345678910111213141516171819202122232425

获取房间信息

请求地址:
http://capi.douyucdn.cn/api/v1/room/<room_id>?aid=android&client_sys=android&time=<time>&auth=c0a6170a754ca187e8a52a3343ecf273
参数:
room_id: 房间ID
time: unix_time/1000
auth: md5("room/"+room_id+"?aid=android&client_sys=android&time="+1231) 注意:time要和上面一致,android也不能改成ios
插曲[不重要可以跳过不看]:为了查找auth的算法,我先是反编译了斗鱼的apk,结果他们把算法藏在了JNI里,随后尝试反汇编找出来的Share Object,无果。然后在斗鱼网页里的javascript里各种找,也没有,不过发现网页里也有一条类似的API,是从swf里发出的。之后去逐个反编译斗鱼网页里的swf,发现核心的core.swf是被加密了的,好在webroom.swf里找到了解密逻辑。解密后找到一个算sign/auth的function,然而没看懂,是一种变形的C。。最后的最后我在github上搜了一下之前解密用的key,发现之前果然有大神找到了auth算法,附链接。拿到算法,玩了一圈发现必须是这个格式才行,把android换成ios就会验证失败。
返回数据:

{
	"error": 0,
	"data": {
	"room_id": "58428",
	"room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/23/23/58428_160223234559.jpg",
	"cate_id": "3",
	"room_name": "yyf直播间  电子竞技只有锤!",
	"vod_quality": "0",
	"show_status": "2",
	"show_time": "1456221459",
	"owner_uid": "236231",
	"specific_catalog": "",
	"specific_status": "1",
	"online": 0,   // 这个是在线人数,虽然比较虚
	"nickname": "yyfyyf",
	"url": "/58428",
	"game_url": "/directory/game/DOTA2",
	"game_name": "DOTA2",
	"game_icon_url": "/file/imgs/upload/202301/31/huue2yhkyzx.jpg",
	"rtmp_url": "",   //如果再直播会有,我抓这个时候鱼鱼枫已经被怼的下播了
	"rtmp_live": "",
	"rtmp_cdn": "",
	"rtmp_multi_bitrate": [],
	"hls_url": "",
	"servers": [   //这个就比较重要了,这个是弹幕验证服务器列表!弹幕相关的socket加密解密源代码我也找到了。如有需求请留言,我看情况发出来。
		{
		"ip": "119.90.49.93",
		"port": "8063"
		},
		....略
	],
	"use_p2p": "0",
	"room_dm_delay": 30,
	"black": [],
	"show_details": "yyf贴吧: http://tieba.baidu.com/f?kw=yyf&amp;fr=ala0&amp;tpl=5\n新浪微博: http://www.weibo.com/u/2176141495/home?wvr=5",
	"owner_avatar": "http://uc.douyutv.com/avatar.php?uid=236231&size=big",
	"cdns": [],
	"owner_weight": "304.67t",   //主播体重
	"fans": "492867",             //这个应该是关注数。
	"gift": [                  //一些礼物信息
		{
		"id": "59",
		"name": "火箭",
		"pc": "50000",
		"type": "2",
		"gx": 5000,
		"desc": "赠送网站广播并派送出神秘宝箱",
		"intro": "我们的征途是星辰大海",
		"ef": 1,
		"pimg": "/file/imgs/upload/202301/31/xi0oxboyftl.jpg",
		"mimg": "/file/imgs/upload/202301/31/g1i4bqnpyyt.jpg",
		"cimg": "/file/imgs/upload/202301/31/hbuqgrsxkae.jpg",
		"himg": "/file/imgs/upload/202301/31/mteqdkzdan1.jpg",
		"stay_time": 200000,
		"drgb": "",
		"urgb": "#732909",
		"grgb": "#732909",
		"brgb": "#5861b5",
		"pdbimg": "/file/imgs/upload/202301/31/cyn5x4j34vp.jpg",
		"pdhimg": "/file/imgs/upload/202301/31/qa1myr2osxj.jpg",
		"small_effect_icon": "/file/imgs/upload/202301/31/gxbqt1ec5ny.jpg",
		"big_effect_icon": "/file/imgs/upload/202301/31/jo3f4qkusnd.jpg",
		"pad_big_effect_icon": "/file/imgs/upload/202301/31/c103v1xfgsv.jpg"
		},
		...略
	]
	}
}
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768

搜索直播间

请求地址:
http://capi.douyucdn.cn/api/v1/searchNew/<search_string>/1?limit=1&offset=0
参数:
search_string: 要搜索的内容,房间id或者房间名
limit:
offset:
返回数据:

{
	"error": 0,
	"data": {
		"count": 299,
		"room": [
			{
			"room_id": "73327",
			"room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/24/02/73327_160224021924.jpg",
			"cate_id": "134",
			"room_name": "返回Windows写个博客",
			"show_status": "1",
			"subject": "",
			"show_time": "1456244441",
			"owner_uid": "2154075",
			"specific_catalog": "dotaonly",
			"specific_status": "1",
			"vod_quality": "0",
			"nickname": "ShaneX",
			"online": 5,
			"child_id": "0",
			"url": "/dotaonly",
			"game_url": "/directory/game/wsm",
			"game_name": "玩数码",
			"fans": "2490"
			}
		]
	}
}
12345678910111213141516171819202122232425262728

以上就是我觉着有用的不用登陆可获取API,下面是需要登陆的

获取登陆token

请求地址:
http://capi.douyucdn.cn/api/v1/login?username=<user_name>&password=<password_md5>
参数:
user_name: 用户名
password_md5: 密码的md5
返回数据:

{
	"error": 0,
	"data": {
	"uid": "2154075",
	"username": "auto_beKEugHSJv",
	"nickname": "ShaneX",
	"email": "245****@qq.com",  //不知道斗鱼为何要遮蔽邮箱以及下面的电话
	"qq": "",
	"mobile_phone": "150****3913",
	"phone_status": "1",
	"email_status": "1",
	"lastlogin": "1455383420",
	"avatar": {  //头像
		"small": "http://uc.douyutv.com/avatar.php?uid=2154075&size=small",
		"middle": "http://uc.douyutv.com/avatar.php?uid=2154075&size=middle",
		"big": "http://uc.douyutv.com/avatar.php?uid=2154075&size=big"
	},
	"has_room": "1", //是否是直播
	"groupid": "1",
	"is_own_room": "1",
	"gold1": "4772",  //鱼丸数
	"score": "117020", //经验值
	"level": {
		"current": {
			"lv": 12,
			"pic": "user12.gif",
			"mpic": "gold05.png",
			"name": "黄金5",
			"pic_url": "/file/imgs/upload/202301/31/h1d1vdiundu.jpg?v=v26185",
			"score": 100000
		},
		"next": {
			"lv": 13,
			"pic": "user13.gif",
			"mpic": "gold04.png",
			"name": "黄金4",
			"pic_url": "/file/imgs/upload/202301/31/3bcnerwdld2.jpg?v=v26185",
			"score": 150000
		}
	},
	"follow": "35",
	"ios_gold_switch": 1,
	"gold": "372.4", //鱼翅
	"token": "a**********a",  //token!
	"token_exp": 1457111772 //过期时间,十天
	}
}
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647

获取个人信息

请求地址:
http://capi.douyucdn.cn/api/v1/my_info?token=<token>
参数:
token: 登陆token
返回数据:

和上面的一毛一样。
1

获取关注列表

请求地址:
http://capi.douyucdn.cn/api/v1/remind_list?token=<token>&limit=1&offset=1
参数:
token:
limit:
offset:
请求地址2:
http://capi.douyucdn.cn/api/v1/followRoom?token=<token>&live=1
参数:
token:
live: 1是正在直播的,0是没开直播的
返回数据:

{
"error": 0,
"data": [
	{
	"id": "163643",
	"room_id": "163643",
	"room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/24/00/163643_160224001525.jpg",
	"cate_id": "26",
	"nickname": "蓝天上的流云",
	"show_status": "2",
	"owner_uid": "4773042",
	"name": "【流云红警】一个人默默地直播,5555~",
	"game_tag_id": "26",
	"game_tag_name": "怀旧游戏",
	"owner": "蓝天上的流云",
	"owner_avatar_small": "http://uc.douyutv.com/avatar.php?uid=4773042&size=small",
	"owner_avatar_middle": "http://uc.douyutv.com/avatar.php?uid=4773042&size=middle",
	"owner_avatar_big": "http://uc.douyutv.com/avatar.php?uid=4773042&size=big",
	"remind_status": "0",
	"live_status": "2",
	"online": 0,
	"show_time": "1456238974",
	"fans": "47425"
	}
]
}
1234567891011121314151617181920212223242526

取消关注

【POST】请求地址:
http://capi.douyucdn.cn/api/v1/follow/del

参数:
ids: 要取消关注的列表, e.g.:123,321,132
返回数据:

{
	"error": 0,
	"data": [20360, 184219]
}
1234

获取观看历史

请求地址:
http://capi.douyucdn.cn/api/v1/history?token=<token>
参数:
token:
返回数据:

{
	"error": 0,
	"data": [
		{
		"room_id": "73327",
		"room_class="lazy" data-src": "http://rpic.douyucdn.cn/z1602/24/01/73327_160224015628.jpg",
		"cate_id": "134",
		"room_name": "返回Windows写个博客",
		"show_status": "1",
		"subject": "",
		"show_time": "1456244441",
		"owner_uid": "2154075",
		"specific_catalog": "dotaonly",
		"specific_status": "1",
		"vod_quality": "0",
		"nickname": "ShaneX",
		"online": 4,
		"child_id": "0",
		"url": "/dotaonly",
		"game_url": "/directory/game/wsm",
		"game_name": "玩数码",
		"rid": "73327",
		"oid": "2154075",
		"n": "返回Windows写个博客",
		"lt": "1456246497",
		"uc": "5",
		"ls": "1",
		"on": "ShaneX",
		"fans": "2489"
		}
	]
}
1234567891011121314151617181920212223242526272829303132

我写这个时候在直播,有个人跑我直播间说我抓这个毫无意义,那我就呵呵了。还有就是不得不感慨一下斗鱼程序猿写代码能力之弱,我翻代码时候甚至看到过这样的代码(time/1000/60)*60 前端js也是很乱。
额,如果有什么问题或者不明,欢迎留言,转载请注明。
我的直播间: 斗鱼 不定时会直播码code

 

 

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

一些斗鱼TV Web API [Some

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

一些斗鱼TV Web API [Some

去年TI5前开发了dotaonly.com,网站需要用到各个直播平台API。不像国外网站Twitch那样开放,都有现成的API可用,国内网站都很封闭,对开发者不太友好。本文所涉及API皆抓取自斗鱼IOS手机客户端。获取当前全部直播请求地址:
2023-01-31

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录