Researched the principle of Youku VIP video analysis overnight

2019-04-18 20:15 Column: Industry dynamics view ( )

Recently, a friend wanted to do video parsing, so Baidu took a look. The video parsing interface has been bad, but I bought VIP for a long time with infinite love for technology and silly. I analyzed Youku video, VIP video parsing website and software overnight. , You only need to paste the video address or open the video website in the app to watch it for free, and the ads are automatically skipped. So how does the video parsing interface work? Every major video on the market has a web version and an app version. No matter what version you need to communicate with the server, we can imitate this process, add or delete the verification link, or imitate the fake verification link. Before that, we need to get the playback address of the video

The link below is the watch page of Integrity.
/v.swf个链接 In the play page we found XNDEwNTI2ODIwNA == /v.swf links

XNDEwNTI2ODIwNA == is the key point, we create a new html file to call this flash file, the code is as follows

</ head>
<embed src = "" quality = "high" width = "480" height = "400" align = "middle" allowAccess = "sameDomain" type = "application / x-shockwave-flash"> </ embed>
</ body>
Play successfully, as shown

&ccode=0405&client_ip= 地址 The browser requested an XNDEwNTI2ODIwNA == & ccode = 0405 & client_ip = & utid = vqBmFN3TJh8CARsUWyRy% 252FG% 252FR & client_ts = 1553444878 & r = TJXNtUvzyfw6bw6b6 = 1 & p = 1 & fu = 0 & wintype = BDskin & vs = 1.0 & rst = flv & dq = auto & os = Windows & osv = 10 & d = 0 & bt = pc & aw = w & partnerid = 0edbfd2e4fc91b72 & refer = address

The connection has 6 parameters: vid, ccode, ckey, client_ip, utid, client_ts

.html?spm=a2ha1.12528442.m_4424_c_11054_1.d_01 We analyze the video address: XNDEwNTI2ODIwNA == .html? Spm = a2ha1.12528442.m_4424_c_11054_1.d_01

Among them: vid is the address of the video. Red part: XNDUxNDcxMTU2, ccode is fixed at 405. Tested 3 VIP videos. No other client_ip was found. Fill in the IP of your computer. Baidu search the IP to get utid. I blindly changed and can access client_ts. It is the timestamp in Google. Or 360 browser, press f12 and enter Date.parse (new Date ());

Via get request = 1 & fu = 0 & wintype = BDskin & vs = 1.0 & rst = flv & dq = auto & os = Windows & osv = 10 & d = 0 & bt = pc & aw = w & partnerid = 0edbfd2e4fc91b72 & refer =
Will get a very long json

Analyze json using json format tool

Video information:

Video likes and dislikes:

This is to tell the player what language version of the video needs to be played:

This part is the highlight of the video:

The next big thing is

There are 3 branches in the stream:

Where each branch represents a different clarity 0 & ups_key = 649b983c9cb182dd95caf6b4819dd97b

The parameter content is simple and easy to understand and will not be introduced one by one.

Among them stream_type: "mp4hd2" stream_type: mp4hd2 stands for ultra clear, flvhd high definition, mp4hd stands for standard definition

In segs is the detailed data of each segment of the video and the cdn address:

Open the cdn address directly to download the video segment

If you want to get the real address of the video, download the m3u8 file directly and open it with notepad ++

You can see that this is a 10-minute shard file XNDEwNTI2ODIwNA% 3D% 3D & vkey = A0cc870e2503388cd57493748907f0660 & s = 7448b21d805a472eb6dd & sp =

Removed parameters: is the real download address of the video

Get the address that can be played as shown in the figure

Even a god, only the first and second addresses have, the third address is gone, which is embarrassing. It seems that you need to buy a VIP account to get all the addresses. . .
But this is easy to handle, we have already reached this step, we only need to buy a VIP number to serve everyone.

It's too late, I have to go to work tomorrow and I will just give ideas.

The idea is as follows:
Use selnium to simulate the user watching the video. When the app end user sends a video link, selnium uses Google to open the link, grab the final segs data and m3u8_url data, return it to the server, cache it, and return it to the app. See can return the cached data directly.
There are three ways to provide services here. One is to directly provide the mp4 address to the client app. The app adds the mp4 to the queue to download and play. The other solution is to directly download the mp4 on the server and provide playback through the m3u8 protocol. The other is directly This solution for Youku's m3u8_url address may or may not require login status. You can try it.

Other major video websites can also use this method to analyze and analyze.

I wo n’t buy VIP, just use someone ’s url, and you can watch it on the phone by packing an app. The download address is here
This article is for study and research use only. Do not use it for illegal purposes.

Dajiangyun Network Technology-Provide you with website construction, app development, applet development, advertising production, video production, advertising, seo optimization, website promotion
Scan the QR code to communicate with the project manager

We look forward to your voice on WeChat for 24 hours

Answer questions in this article / Technical consultation / Operational consultation / Technical advice / Internet communication

Zheng Mingming reiterates: Any unit or individual outside Dajiang Cloud Network Technology shall not use this case as a successful job demonstration!