Some Betta TV Web APIs [Some DouyuTv APIs]

 

Written in the forefront

Developed before TI5 last year dotaonly.com Web sites need to use APIs of various live platforms. Unlike Twitch, which is not as open as foreign websites, there are ready-made APIs available. Domestic websites are closed and not very friendly to developers. The APIs mentioned in this paper are all crawled from the FISH IOS mobile phone client.

First, API s that do not require login

Get all current live broadcasts

Request address:
http://capi.douyucdn.cn/api/v1/live?limit=20&offset=0
Parameters:
limit: Number of acquisitions at a time
Offset: The starting position, such as offset=20 after the first 20, is the same as below
Return data

{
    "error": 0,
    "data": [
        {
        "room_id": "16101",
        "room_src": "http://rpic.douyucdn.cn/z1602/22/16/16101_160222165702.jpg",
        "cate_id": "1",
        "room_name": "Smile: You should bring your sister for the holidays!",
        "show_status": "1",
        "subject": "",
        "show_time": "1456126421",
        "owner_uid": "391270",
        "specific_catalog": "weixiao",
        "specific_status": "1",
        "vod_quality": "0",
        "nickname": "Smile",
        "online": 1075780,
        "url": "/weixiao",
        "game_url": "/directory/game/LOL",
        "game_name": "League of Heroes",
        "child_id": "28",
        "fans": "936235"
        }
    ]
}
12345678910111213141516171819202122232425

Get the parent channel

Request address:
http://capi.douyucdn.cn/api/v1/getColumnList
Partial return data:

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

Get subchannels

Request address:
http://capi.douyucdn.cn/api/v1/getColumnDetail?shortName=game
Parameters:
shortName: parent channel name, short_name from the last request to return data
Partial return data:

{
    "error": 0,
    "data": [
        {
            "tag_id": "134",
            "short_name": "wsm",
            "tag_name": "Play digital",
            "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": "http://staticlive.douyutv.com/upload/game_cate/7c855c7fa9c8c03697ee61748999d112.jpg",
            "url": "/directory/game/wsm",
            "icon_url": "http://staticlive.douyutv.com/upload/game_cate/a3f49c62bd6156b358a275a07a5b95dd.jpg",
            "count": 15,
            "count_ios": 8
        },
        {
            "tag_id": "136",
            "short_name": "car",
            "tag_name": "Play with cars",
            "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": "http://staticlive.douyutv.com/upload/game_cate/6b83cf650fb4ba62881c9c528ab602d5.jpg",
            "url": "/directory/game/car",
            "icon_url": "http://staticlive.douyutv.com/upload/game_cate/ade2b45ee56831c3b100a436b8c2f624.jpg",
            "count": 4,
            "count_ios": 2
        }
    ]
}
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849

Get all live lists of parent channels

Request address:
http://capi.douyucdn.cn/api/v1/getColumnRoom/<cate_id>?limit=20&offset=0
Parameters:
cate_id: parent channel ID
limit
offset
Return data:

{
    "error": 0,
    "data": [
        {
            "room_id": "536341",
            "room_src": "http://rpic.douyucdn.cn/z1602/22/17/536341_160222172043.jpg",
            "cate_id": "134",
            "room_name": "22 5:30 p.m. MWC On-site visits to see products",
            "show_status": "1",
            "subject": "",
            "show_time": "1456132678",
            "owner_uid": "38598100",
            "specific_catalog": "",
            "specific_status": "0",
            "vod_quality": "0",
            "nickname": "ZOL Zhongguancun Online",
            "online": 1969,
            "child_id": "0"
        },
        {
            "room_id": "279558",
            "room_src": "http://rpic.douyucdn.cn/z1602/22/17/279558_160222171918.jpg",
            "cate_id": "136",
            "room_name": "[24H Fighting Fish First Professional Vehicle Review]Chen Zhen YYP Car selection",
            "show_status": "1",
            "subject": "",
            "show_time": "1455963983",
            "owner_uid": "18462494",
            "specific_catalog": "",
            "specific_status": "0",
            "vod_quality": "0",
            "nickname": "Uncle Kim 2015",
            "online": 12304,
            "child_id": "0"
        }
    ]
}
12345678910111213141516171819202122232425262728293031323334353637

Get a list of live subchannels

Request address:
http://capi.douyucdn.cn/api/v1/live/<tag_id>?&limit=1&offset=0
Parameters:
tag_id: subchannel ID
limit
offset
Return data:

{
"error": 0,
"data": [
{
"room_id": "536341",
"room_src": "http://rpic.douyucdn.cn/z1602/22/17/536341_160222172043.jpg",
"cate_id": "134",
"room_name": "22 5:30 p.m. MWC On-site visits to see products",
"show_status": "1",
"subject": "",
"show_time": "1456132678",
"owner_uid": "38598100",
"specific_catalog": "",
"specific_status": "0",
"vod_quality": "0",
"nickname": "ZOL Zhongguancun Online",
"online": 5700,
"url": "/536341",
"game_url": "/directory/game/wsm",
"game_name": "Play digital",
"child_id": "0",
"fans": "4084"
}
]
}
12345678910111213141516171819202122232425

Get room information

Request address:
http://capi.douyucdn.cn/api/v1/room/<room_id>?aid=android&client_sys=android&time=<time>&auth=c0a6170a754ca187e8a52a3343ecf273
Parameters:
room_id: Room ID
time: unix_time/1000
Auth: MD5 ("room/"+room_id+"? Aid = android & client_sys = android & time =" +1231). Note: time should be the same as above, android can not be changed to ios
Interlude [It's not important to skip it]: In order to find the algorithm of auth, I first decompiled the matador's apk, and they hid the algorithm in JNI, then tried to disassemble the Share Object found, but no result. And then in the Dogfish Web page in the javascript all kinds of search, no, but found that the Web page also has a similar API, sent from swf. After decompiling the SWF in the dogfish web page one by one, we find that the core.swf is encrypted. Fortunately, we find the decryption logic in webroom.swf. After decryption, a function of sign/auth is found, but it is not understood. It is a kind of deformed C. Finally, I searched github for the key I used to decrypt, and found that God had found the auth algorithm before. link . Get the algorithm, play a circle to find that it must be in this format, and replace android with ios will fail to verify.
Return data:

{
	"error": 0,
	"data": {
	"room_id": "58428",
	"room_src": "http://rpic.douyucdn.cn/z1602/23/23/58428_160223234559.jpg",
	"cate_id": "3",
	"room_name": "yyf Live studio E-sports only hammer!",
	"vod_quality": "0",
	"show_status": "2",
	"show_time": "1456221459",
	"owner_uid": "236231",
	"specific_catalog": "",
	"specific_status": "1",
	"online": 0,   // This is the number of people online, though it's a bit empty.
	"nickname": "yyfyyf",
	"url": "/58428",
	"game_url": "/directory/game/DOTA2",
	"game_name": "DOTA2",
	"game_icon_url": "http://staticlive.douyutv.com/upload/game_cate/bfe845a28fef8106cf645ed3b83aa375.jpg",
	"rtmp_url": "",   //If there's another live broadcast, I'll catch the fish and Maple by this time.
	"rtmp_live": "",
	"rtmp_cdn": "",
	"rtmp_multi_bitrate": [],
	"hls_url": "",
	"servers": [   //This is more important, this is the list of bullet screen validation servers! I also found the source code of the socket encryption and decryption related to the barrage. Please leave a message if you need it. I'll see what happens.
		{
		"ip": "119.90.49.93",
		"port": "8063"
		},
		....slightly
	],
	"use_p2p": "0",
	"room_dm_delay": 30,
	"black": [],
	"show_details": "yyf Post Bar: http://Tieba.baidu.com/f?Kw=yyf& fr=ala0& tpl=5n Sina Weibo: http://www.weibo.com/u/21761495/home?
	"owner_avatar": "http://uc.douyutv.com/avatar.php?uid=236231&size=big",
	"cdns": [],
	"owner_weight": "304.67t",   //Anchors weight
	"fans": "492867",             //This should be the number of concerns.
	"gift": [                  //Some Gift Information
		{
		"id": "59",
		"name": "rocket",
		"pc": "50000",
		"type": "2",
		"gx": 5000,
		"desc": "Giving websites broadcasts and sending out mysterious treasure boxes",
		"intro": "Our journey is the sea of stars",
		"ef": 1,
		"pimg": "http://staticlive.douyutv.com/upload/dygift/447b61f6c0d6890d4490a90d0bdbf8bc.png",
		"mimg": "http://staticlive.douyutv.com/upload/dygift/ab957377200959761121a3791a54b9b7.png",
		"cimg": "http://staticlive.douyutv.com/upload/dygift/7dce6b2170eebecf85596b47370217ce.gif",
		"himg": "http://staticlive.douyutv.com/upload/dygift/7f0643700d331aca31a6f6ea255e323e.gif",
		"stay_time": 200000,
		"drgb": "",
		"urgb": "#732909",
		"grgb": "#732909",
		"brgb": "#5861b5",
		"pdbimg": "http://staticlive.douyutv.com/upload/dygift/005786105dd86e3964732e7fc2fc2085.png",
		"pdhimg": "http://staticlive.douyutv.com/upload/dygift/6ffb9bc8d35d315943ae117dc788824e.gif",
		"small_effect_icon": "http://staticlive.douyutv.com/upload/dygift/75e55aae938fc703d977e8c966fef91d.png",
		"big_effect_icon": "http://staticlive.douyutv.com/upload/dygift/40f964e70faa46923dcc4c4931bbac8f.gif",
		"pad_big_effect_icon": "http://staticlive.douyutv.com/upload/dygift/ccffe8c6453074a68be1730802203241.gif"
		},
		...slightly
	]
	}
}
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768

Search Live Studio

Request address:
http://capi.douyucdn.cn/api/v1/searchNew/<search_string>/1?limit=1&offset=0
Parameters:
search_string: The content to be searched, room id or room name
limit:
offset:
Return data:

{
	"error": 0,
	"data": {
		"count": 299,
		"room": [
			{
			"room_id": "73327",
			"room_src": "http://rpic.douyucdn.cn/z1602/24/02/73327_160224021924.jpg",
			"cate_id": "134",
			"room_name": "Return Windows Write a blog",
			"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": "Play digital",
			"fans": "2490"
			}
		]
	}
}
12345678910111213141516171819202122232425262728

These are the API s that I feel useful without having to log in. Here are the ones that need to log in.

Available API s to be logged in

Get landing token

Request address:
http://capi.douyucdn.cn/api/v1/login?username=<user_name>&password=<password_md5>
Parameters:
user_name: User name
password_md5: password MD5
Return data:

{
	"error": 0,
	"data": {
	"uid": "2154075",
	"username": "auto_beKEugHSJv",
	"nickname": "ShaneX",
	"email": "245****@qq.com",  //I don't know why the betta shielded the mailbox and the telephone below.
	"qq": "",
	"mobile_phone": "150****3913",
	"phone_status": "1",
	"email_status": "1",
	"lastlogin": "1455383420",
	"avatar": {  //Head portrait
		"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", //Is it live?
	"groupid": "1",
	"is_own_room": "1",
	"gold1": "4772",  //Number of fish balls
	"score": "117020", //Empirical value
	"level": {
		"current": {
			"lv": 12,
			"pic": "user12.gif",
			"mpic": "gold05.png",
			"name": "Gold 5",
			"pic_url": "http://staticlive.douyutv.com/common/douyu/images/classimg/user12.gif?v=v26185",
			"score": 100000
		},
		"next": {
			"lv": 13,
			"pic": "user13.gif",
			"mpic": "gold04.png",
			"name": "Gold 4",
			"pic_url": "http://staticlive.douyutv.com/common/douyu/images/classimg/user13.gif?v=v26185",
			"score": 150000
		}
	},
	"follow": "35",
	"ios_gold_switch": 1,
	"gold": "372.4", //Shark's fin
	"token": "a**********a",  //token!
	"token_exp": 1457111772 //Overdue time, ten days
	}
}
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647

Access to personal information

Request address:
http://capi.douyucdn.cn/api/v1/my_info?token=<token>
Parameters:
Token: landing token
Return data:

It's the same as the hair above.
1

Get a list of concerns

Request address:
http://capi.douyucdn.cn/api/v1/remind_list?token=<token>&limit=1&offset=1
Parameters:
token:
limit:
offset:
Request address 2:
http://capi.douyucdn.cn/api/v1/followRoom?token=<token>&live=1
Parameters:
token:
live: 1 is live, 0 is not live.
Return data:

{
"error": 0,
"data": [
	{
	"id": "163643",
	"room_id": "163643",
	"room_src": "http://rpic.douyucdn.cn/z1602/24/00/163643_160224001525.jpg",
	"cate_id": "26",
	"nickname": "Flowing clouds in the blue sky",
	"show_status": "2",
	"owner_uid": "4773042",
	"name": "[Liuyun Red Police] A person silently broadcast live, 5555~",
	"game_tag_id": "26",
	"game_tag_name": "Nostalgic game",
	"owner": "Flowing clouds in the blue sky",
	"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

Remove concerns

[POST] Request address:
http://capi.douyucdn.cn/api/v1/follow/del

Parameters:
ids: To cancel the list of concerns, e.g.:123,321,132
Return data:

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

Obtaining Viewing History

Request address:
http://capi.douyucdn.cn/api/v1/history?token=<token>
Parameters:
token:
Return data:

{
	"error": 0,
	"data": [
		{
		"room_id": "73327",
		"room_src": "http://rpic.douyucdn.cn/z1602/24/01/73327_160224015628.jpg",
		"cate_id": "134",
		"room_name": "Return Windows Write a blog",
		"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": "Play digital",
		"rid": "73327",
		"oid": "2154075",
		"n": "Return Windows Write a blog",
		"lt": "1456246497",
		"uc": "5",
		"ls": "1",
		"on": "ShaneX",
		"fans": "2489"
		}
	]
}
1234567891011121314151617181920212223242526272829303132

Written in the end

When I write this time, I AM broadcasting live, and someone runs to my studio and says it's meaningless for me to catch this, so I'll haw. Also, I have to lament the weakness of the code-writing ability of the game program ape. I even saw such code (time/1000/60)*60 front-end js is very messy when I flipped through the code.
Well, if you have any questions or uncertainties, please leave a message and reproduce it.
My live studio: Fighting fish From time to time live code

Keywords: Python PHP Android Windows iOS

Added by KendersPlace on Sat, 18 May 2019 21:08:39 +0300