ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.39k stars 9.96k forks source link

Improve youku extraction #15092

Open CoXier opened 6 years ago

CoXier commented 6 years ago

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.12.23. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

Before submitting an issue make sure you have:

What is the purpose of your issue?


Recently I am working on extraction for youku website for a week. I find there are two bugs in current extraction.

Yesterday I found a new api from Chrome when I visit youku.com. Here is the api : http://acs.youku.com/h5/mtop.youku.play.ups.appinfo.get/1.1/

I want to implement this algo but I failed (This is why I create this issue). I put my test code from Chrome here. I have remove redundant query params.

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import re
import time
import random
import hashlib
import requests

data = '{' \
       '"steal_params":"{\"ccode\":\"0502\",\"client_ip\":\"192.168.1.1\",\"utid\":\"73KtEl7ZR0QCAdNFwkGIJtN9\",\"client_ts\":1514387235,\"ckey\":\"099#KAFEHYEKExdEIETLEEEEE6twSciqQ6NFSryoS6tqS9lMC6f3SXLEa6gTSc3on6fFN7FETcZdt91lE7EFL2xhGQoTEK5E8yKK/qYWcTZB95lWYsXWPyUt+O/kNar/roC6UQCSqedbToXHb2o+eK4HiRXhKscXvLnqUqSZ6wUWa4wsDRrsrAXcLylpHshnPvZcbfEVbix/iGCGDyXBrpls3rh4vKI084K1doc2vK+x3/ujzKI08eEwuuyiUT8xh9dwQo708gGyuasgZ1hxh0UwllJw8zGg4LslN2STE1LP/3iSlllP/cZddmJlluuWsyaA59llsLLP/3HjlllrSXZddmJlluQQOGFETrudt/B5CTSTEELP/3kmBYeC1W4TEHRE45amihKMnH4IcroWoD4fB0ANtkj2LEABiC8KfwwqL7SB9r5aMQGBB7GQPaffB7aqkhWKfwwqkqGB9r5a6V+I1DN7VmGt+IYRkmwgBwSq1VA3TGFETrZSt3illAdTEE7EERpC#82\"}",' \
       '"biz_params":"{\"vid\":\"XMTQ4ODQ3Mjc1Ng==\"}",' \
       '"ad_params":"{\"site\":1,\"wintype\":\"interior\",\"p\":1,\"fu\":0,\"vs\":\"1.0\",\"rst\":\"mp4\",\"dq\":\"hd2\",\"os\":\"mac\",\"osv\":\"\",\"d\":\"0\",\"bt\":\"pc\",\"aw\":\"w\",\"needbf\":1}"}'

param = {
    'appKey': '23536927',
    't': ts,
    'sign': '8311888fc9fee1814e8add4800c31ff3',
    'data': data
}
a = requests.get("http://acs.youku.com/h5/mtop.youku.play.ups.appinfo.get/1.1/", params=param)
print a.text

I received below result.

{"api":"mtop.youku.play.ups.appinfo.get","data":{},"ret":["FAIL_SYS_TOKEN_EMPTY::令牌为空"],"v":"1.1"}

Now I have two question.

yan12125 commented 6 years ago

This may be useful for sign: https://www.sslcvm.com/2017/12/07/68.html

And I remember the content of ckey is embedded in a Javascript file

q228209 commented 6 years ago

hello
http://v.youku.com/v_show/id_XMzIwNzAyMjQyNA==.html this url can not download with ccode 0507 , please solve it