最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【未解决】模拟优酷视频播放,刷新播放次数 + 【虽然已实现】获得优酷视频flv播放地址并可下载

Crawl_EmulateLogin crifan 6273浏览 0评论

【问题】

想要模拟优酷视频播放,刷新视频播放次数。

以此为例:

视频:燕山大讲堂 中国如何走向公民社会 4-3

http://v.youku.com/v_show/id_XMjIxMjUzNjQ0.html

想要通过C#程序模拟刷新其播放次数。

【解决过程】

通过IE9的F12,很容易抓取出一些记录,下面就一个个分析分析:
================================================================================
http://v.youku.com/v_show/id_XMjIxMjUzNjQ0.html

resp html:

 

分析:

可以获得对应的网页的源码,其中可以搜索到:

var videoId = ‘55313411’;
var videoId2= ‘XMjIxMjUzNjQ0’;

其中

(1)videoId为视频的id,后面都会用到此id。

(2)videoId2是该视频编码后的标识符,对应着网页地址:

http://v.youku.com/v_show/id_XMjIxMjUzNjQ0.html

中的XMjIxMjUzNjQ0。

================================================================================
http://static.youku.com/v1.0.0252/v/swf/player.swf

IE9会去获得对应的swf播放器。

尝试了下通过网页直接访问此地址,得到的结果是:

抱歉,数据异常,您可以尝试刷新操作。

如果问题仍未解决,请反馈给我们。

错误代码 2002

很明显,是没有指定对应的需要播放的视频,导致此种错误的。

当然,普通用户,偶尔也是会遇到此错误的:

优酷视频错误代码2002是什么意思,怎么解决

================================================================================
http://v.youku.com/QVideo/~ajax/getVideoPlayInfo?__rt=1&__ro=&id=55313411&type=vv

resp json:
{"vv":1434,"ss":"hokHVjEl2go76xECZzS8sw"}

分析:返回vv的值是播放次数。

================================================================================
http://comments.youku.com/comments/~ajax/getStatus.html?__ap=%7B%22videoid%22%3A%2255313411%22%2C%22userid%22%3A%2234988573%22%2C%22oldSid%22%3A-1%7D&__ai=&__callback=commentInfoCallback

resp json:
commentInfoCallback({"total":0,"new_count":0,"last_sid":"-1","create_at":0,"last_modify":null,"last_hot_modify":0,"owner_count":0})

分析:此url访问,对过程分析,好像没太大作用。

================================================================================
http://notice.youku.com/notice/js_nova_notify.json?__ap=%7B%22uid%22%3A%2234988573%22%2C%22rand%22%3A0.005304480005637213%7D&__ai=&__callback=NoticeBox.noticeCallback
resp json:
NoticeBox.noticeCallback({"error":1,"cost":0.0007631778717041,"notice":[]})

分析:此url访问,对过程分析,好像没太大作用。

================================================================================
http://v.youku.com/player/getPlayList/VideoIDS/XMjIxMjUzNjQ0/timezone/+08/version/5/source/video?ran=8020&password=&n=3
resp json:
{"data":[{"ct":"t","cs":"251","logo":"http:\/\/g4.ykimg.com\/1100641F464CD949A7B0830215E21DD881BB46-83CB-79E2-115A-DA9190635C92","seed":3234,"tags":["\u71d5\u5c71\u5927\u8bb2\u5802","\u516c\u6c11\u793e\u4f1a"],"categories":"87","videoid":"55313411","vidEncoded":"XMjIxMjUzNjQ0","username":"crifan","userid":"34988573","title":"\u71d5\u5c71\u5927\u8bb2\u5802 \u4e2d\u56fd\u5982\u4f55\u8d70\u5411\u516c\u6c11\u793e\u4f1a 4-3","up":20,"down":0,"ts":"hvnSfjIl2g086xEBT*HMsw","tsup":"hvnaFDEl2g086xECJenMsw","lastpoint":184611,"key1":"b14bb146","key2":"f6f7f5c2491abd05","tt":"0","videoSource":"2","seconds":"1817.54","streamfileids":{"flv":"53*52*53*53*53*0*53*28*53*53*2*17*14*58*2*58*59*54*17*43*17*28*53*0*9*28*25*0*9*14*59*59*57*50*9*9*25*17*56*9*9*14*22*56*52*50*53*14*56*59*57*52*43*56*22*54*50*53*25*53*9*14*22*2*22*58*"},"segs":{"flv":[{"no":"0","size":"13142375","seconds":"426","k":"a12dc5281298552b261c7826","k2":"147110d485936ae7c"},{"no":"1","size":"13141099","seconds":"426","k":"1983148b0f4cd5982827db68","k2":"12b8b9f91f7a34d60"},{"no":"2","size":"13170209","seconds":"426","k":"6bdc272596007b9c241114e3","k2":"17c9b67018cb670cf"},{"no":"3","size":"12973481","seconds":"426","k":"8b86c8c8ac75d182261c7826","k2":"1fc63fef2c22ad43c"},{"no":"4","size":"3649755","seconds":"113","k":"bb7075e3deebc905261c7826","k2":"1001462b4cd9cb0b1"}]},"streamsizes":{"flv":"56076919"},"stream_ids":{"flv":"24718343"},"streamlogos":{"flv":"1"},"streamtypes":["flv"],"streamtypes_o":["flvhd"]}],"user":{"id":"34988573"},"controller":{"search_count":true,"mp4_restrict":1,"stream_mode":2,"share_disabled":false,"download_disabled":false,"video_capture":true,"area_code":320500,"dma_code":4837,"continuous":0,"playmode":"normal"}}

formated json:
{
"data": [{
"ct": "t",
"cs": "251",
"logo": "http:\/\/g4.ykimg.com\/1100641F464CD949A7B0830215E21DD881BB46-83CB-79E2-115A-DA9190635C92",
"seed": 3234,
"tags": ["\u71d5\u5c71\u5927\u8bb2\u5802", "\u516c\u6c11\u793e\u4f1a"],
"categories": "87",
"videoid": "55313411",
"vidEncoded": "XMjIxMjUzNjQ0",
"username": "crifan",
"userid": "34988573",
"title": "\u71d5\u5c71\u5927\u8bb2\u5802 \u4e2d\u56fd\u5982\u4f55\u8d70\u5411\u516c\u6c11\u793e\u4f1a 4-3",
"up": 20,
"down": 0,
"ts": "hvnSfjIl2g086xEBT*HMsw",
"tsup": "hvnaFDEl2g086xECJenMsw",
"lastpoint": 184611,
"key1": "b14bb146",
"key2": "f6f7f5c2491abd05",
"tt": "0",
"videoSource": "2",
"seconds": "1817.54",
"streamfileids": {
"flv": "53*52*53*53*53*0*53*28*53*53*2*17*14*58*2*58*59*54*17*43*17*28*53*0*9*28*25*0*9*14*59*59*57*50*9*9*25*17*56*9*9*14*22*56*52*50*53*14*56*59*57*52*43*56*22*54*50*53*25*53*9*14*22*2*22*58*"
},
"segs": {
"flv": [{
"no": "0",
"size": "13142375",
"seconds": "426",
"k": "a12dc5281298552b261c7826",
"k2": "147110d485936ae7c"
}, {
"no": "1",
"size": "13141099",
"seconds": "426",
"k": "1983148b0f4cd5982827db68",
"k2": "12b8b9f91f7a34d60"
}, {
"no": "2",
"size": "13170209",
"seconds": "426",
"k": "6bdc272596007b9c241114e3",
"k2": "17c9b67018cb670cf"
}, {
"no": "3",
"size": "12973481",
"seconds": "426",
"k": "8b86c8c8ac75d182261c7826",
"k2": "1fc63fef2c22ad43c"
}, {
"no": "4",
"size": "3649755",
"seconds": "113",
"k": "bb7075e3deebc905261c7826",
"k2": "1001462b4cd9cb0b1"
}]
},
"streamsizes": {
"flv": "56076919"
},
"stream_ids": {
"flv": "24718343"
},
"streamlogos": {
"flv": "1"
},
"streamtypes": ["flv"],
"streamtypes_o": ["flvhd"]
}],
"user": {
"id": "34988573"
},
"controller": {
"search_count": true,
"mp4_restrict": 1,
"stream_mode": 2,
"share_disabled": false,
"download_disabled": false,
"video_capture": true,
"area_code": 320500,
"dma_code": 4837,
"continuous": 0,
"playmode": "normal"
}
}

分析:此处很明显,是获得了一堆的后续所需要的值。

================================================================================
http://stat.youku.com/player/addPlayerStaticReport
post data:
videoid=55313411&sid=134335160910211021209&source=video&h=F8MvIZ074GBOIagk&referer=null&t=hvnSfjIl2g086xEBT%2AHMsw&uid=34988573&totalseg=5&url=http%3A%2F%2Fv%2Eyouku%2Ecom%2Fv%5Fshow%2Fid%5FXMjIxMjUzNjQ0%2Ehtml&fullflag=0&ikuflag=n1&totalsec=1817

关于这个地址,网上找了一推,找到这里了:

(1)http://v.sogou.com/playevent.pat

中有关于优酷的地址:

http://stat.youku.com/player/addPlayerDurationReport
http://stat.youku.com/player/addPlayerStaticReport
http://stat.youku.com/player/addPlayerDynamicReport

(2)http://topic.csdn.net/u/20090314/17/1cb4e6a8-c73e-4cac-a167-34e37d25220a.html

里面的获取flv地址,我这里已经可以搞定。

不过其中里面有referer是对应的swf,倒是可以借鉴。

(3)apache日志异常

其也贴出了一些相关的POST。

 

================================================================================
http://stat.youku.com/player/addPlayerDurationReport?viewUserId=34988573&number=59&Tid=0&sid=134335160910211021209&format=0&timestamp=1343351610229&playComplete=0&url=http%3A%2F%2Fv%2Eyouku%2Ecom%2Fv%5Fshow%2Fid%5FXMjIxMjUzNjQ0%2Ehtml&referUrl=null&rnd=2003&emb=AjU1MzEzNDExAnYueW91a3UuY29tAnZfc2hvdy9pZF9YTWpJeE1qVXpOalEwLmh0bWw%3D&ct=t&currentPlayTime=218%2E891&cs=251&continuationPlay=1&source=video&winType=1&hd=0&videoid=55313411&topHdVideo=0&videoOwnerId=34988573&totalsec=1817&Type=0&starttime=0&fullflag=0&guid=5d174bc8%2Daac4%2D9053%2Dd8b3%2D0553E6F794e3&ikuflag=n&showid%5Fv2=

================================================================================
http://valf.atm.youku.com/valf?ct=t&cs=251&v=55313411&t=1817&u=34988573&fileid=03000205004CD949A7CBC50215E21DAA6811EC-11DF-380D-A63B-F780E01DF4F9&winType=interior&partnerid=null&paid=0&fullflag=0&s=&td=0&k=%u71D5%u5C71%u5927%u8BB2%u5802%7C%u516C%u6C11%u793E%u4F1A

resp json:
{"AT":"0","A2":{"RS":"http://f.youku.com/player/getFlvPath/fileid/030002010050063AB75BF2003E88037FF9318A-6CFC-235D-70CF-8CE77E6D0353?K=30cac45ca1d253a9261c7825&yad=1&ts=15","MU":"http://vid.atm.youku.com/over?v=55313411&p=1&ct=t&cs=251&ca=76323&ie=83264&uid=34988573&pl=2&bl=1&s=&td=0","CMU":"http://g.cn.miaozhen.com/x.gif?k=1002485&p=3xwvK0&rt=2&o=","MT":"10","CU":"http://vid.atm.youku.com/click?v=55313411&p=1&ct=t&cs=251&ca=76323&ie=83264&uid=34988573&pl=2&bl=1&s=&td=0&u=http://e.cn.miaozhen.com/r.gifinterrogation_esckequal_esc1002485and_escpequal_esc3xwvK0and_escaeequal_esc1000292and_escvoequal_esc3be07d19cand_escvrequal_esc2and_escoequal_eschttppercent_esc3Apercent_esc2Fpercent_esc2Fweibo.compercent_esc2Fkfcchina&md5=a9f1e9056b76313f18b2446fcef1821c","SU":"http://g.cn.miaozhen.com/x.gif?k=1002484&p=3xwv90&rt=2&o=","VCU":"","SCU":"","VT":"","VC":"","ATMSU":"http://valf.atm.youku.com/show?v=55313411&p=1&ct=t&cs=251&ca=76323&ie=83264&uid=34988573&pl=2&bl=1&s=&td=0&cookie=1334896463088bUC&vl=15","ISOSU":"","F1":"","F2":"","F3":"0","F4":"0","VL":"15"},"A3":{"RS":"http://f.youku.com/player/getFlvPath/fileid/0300020100500CBF5ED2E9003E88032FBC3EA9-6D29-A7E9-DC07-B84073A851C0?K=cf5b62c0af9bff152827db67&yad=1&ts=15","OU":"http://vid.atm.youku.com/over?v=55313411&p=1&ct=t&cs=251&ca=76849&ie=83872&uid=34988573&pl=3&bl=1&s=&td=0","COU":"","CU":"http://vid.atm.youku.com/click?v=55313411&p=1&ct=t&cs=251&ca=76849&ie=83872&uid=34988573&pl=3&bl=1&s=&td=0&u=http://e.cn.miaozhen.com/r.gifinterrogation_esckequal_esc1002510and_escpequal_esc3xx6x0and_escoequal_eschttp://adclk.thinkmedia.cn/clk/pidequal_esc2040/mediaequal_escYOUKU.CN/placeequal_esc19Yksp/sizeequal_esc640x480&md5=907c2e2d1463d132356f65e4dad9db81","SU":"http://g.cn.miaozhen.com/x.gif?k=1002510&p=3xx6x0&rt=2&o=http://ad.thinkmedia.cn/htracker/pid=2040/media=YOUKU.CN/place=19Yksp/size=640×480","VCU":"","SCU":"","VT":"","VC":"","ATMSU":"http://valf.atm.youku.com/show?v=55313411&p=1&ct=t&cs=251&ca=76849&ie=83872&uid=34988573&pl=3&bl=1&s=&td=0&cookie=1334896463088bUC&vl=15","ISOSU":"http://secure-cn.imrworldwide.com/cgi-bin/m?ci=cn-youku2012&cg=0&cc=1&si=2428/a","F1":"","F2":"","F3":"0","F4":"0","VL":"15"}}

================================================================================
http://h.irs01.com/irt?_iwt_id=TBJBcAtbTE/a82uiR1UStAA=&_iwt_UA=UA-youku-200001&jsonp=SetIDA0&_iwt_p1=A-0-0&_iwt_p2=XMjIxMjUzNjQ0&_iwt_p3=1817-0-0-0&r=1040
resp html:
SetIDA0(‘TBJBcAtbTE/a82uiR1UStAA=’)

================================================================================
http://lstat.youku.com/log.php?&utmn=1266478904&yact=0&yrefer=&ikuIns=0&vcate=ct251_B&device=Win32
resp info:

Key    Value
Response    HTTP/1.1 200 OK
Via    1.1 SC-SZ-06
Connection    Keep-Alive
Proxy-Connection    Keep-Alive
Transfer-Encoding    chunked
Date    Fri, 27 Jul 2012 01:13:33 GMT
Content-Type    text/html
Server    nginx/0.5.33
Set-Cookie    __ysuid=1334896463088bUC; expires=Tue, 19-Jan-2038 03:14:07 GMT; path=/; domain=youku.com
P3P    CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
Set-Cookie    _l_s_c_=a%3A2%3A%7Bs%3A9%3A%22_l_t_last%22%3Bi%3A1343351613%3Bs%3A12%3A%22_l_p_session%22%3Bi%3A1%3B%7D; path=/; domain=lstat.youku.com
Set-Cookie    _l_f_c_=a%3A19%3A%7Bs%3A19%3A%22_l_t_first_gbrowser%22%3Bi%3A1336729295%3Bs%3A16%3A%22_l_t_first_gself%22%3Bi%3A1336729295%3Bs%3A15%3A%22_l_t_last_gcoop%22%3Bs%3A5%3A%22ct251%22%3Bs%3A13%3A%22_l_c_s_domain%22%3Bs%3A1%3A%22-%22%3Bs%3A13%3A%22_l_p_gbrowser%22%3Bi%3A24%3Bs%3A10%3A%22_l_p_gself%22%3Bi%3A24%3Bs%3A10%3A%22_l_p_gcoop%22%3Bi%3A24%3Bs%3A13%3A%22_l_n_gbrowser%22%3Bi%3A6%3Bs%3A10%3A%22_l_n_gself%22%3Bi%3A6%3Bs%3A10%3A%22_l_n_gcoop%22%3Bi%3A6%3Bs%3A9%3A%22_l_g_self%22%3Bs%3A16%3A%221334896463088bUC%22%3Bs%3A9%3A%22_l_g_coop%22%3Bi%3A-2%3Bs%3A12%3A%22_l_t_last_nv%22%3Bi%3A1343351613%3Bs%3A12%3A%22_l_p_session%22%3Bi%3A1%3Bs%3A13%3A%22_l_b_r_string%22%3Bs%3A1%3A%22-%22%3Bs%3A6%3A%22_l_bru%22%3Bs%3A1%3A%22-%22%3Bs%3A12%3A%22_l_g_browser%22%3Bs%3A1%3A%22-%22%3Bs%3A16%3A%22_l_t_first_gcoop%22%3Bs%3A1%3A%22B%22%3Bs%3A13%3A%22_l_t_r_string%22%3Bs%3A26%3A%222012-07-26%2Cwww.baidu.com%2C0%22%3B%7D; expires=Tue, 19-Jan-2038 03:14:07 GMT; path=/; domain=lstat.youku.com

================================================================================
http://irs01.com/irt?_iwt_id=TBJBcAtbTE/a82uiR1UStAA=&_iwt_UA=UA-youku-000001&jsonp=MTH54KV4G81IVS1K&_iwt_p1=&_iwt_p2=&_iwt_p3=&
resp html:
MTH54KV4G81IVS1K(‘TBJBcAtbTE/a82uiR1UStAA=’)

================================================================================
http://f.youku.com/player/getFlvPath/fileid/030002010050063AB75BF2003E88037FF9318A-6CFC-235D-70CF-8CE77E6D0353?K=30cac45ca1d253a9261c7825&yad=1&ts=15
resp info:
Key    Value
Response    HTTP/1.1 302 Found
Via    1.1 SC-SZ-06
Connection    Keep-Alive
Proxy-Connection    Keep-Alive
Content-Length    0
Expires    -1
Date    Fri, 27 Jul 2012 01:13:33 GMT
Location    http://60.217.253.13/youku/69738D184A84C841882D0A5339/030002010050063AB75BF2003E88037FF9318A-6CFC-235D-70CF-8CE77E6D0353.flv
Content-type    text/html
Server    F_LIGHTY_TJ1
Cache-Control    private, max-age=0
Pragma    no-cache

================================================================================
http://60.217.253.13/youku/69738D184A84C841882D0A5339/030002010050063AB75BF2003E88037FF9318A-6CFC-235D-70CF-8CE77E6D0353.flv

================================================================================
http://f.youku.com/player/getFlvPath/fileid/0300020100500CBF5ED2E9003E88032FBC3EA9-6D29-A7E9-DC07-B84073A851C0?K=cf5b62c0af9bff152827db67&yad=1&ts=15

================================================================================
http://60.217.253.11/youku/65737194A814D84267DB2139A6/0300020100500CBF5ED2E9003E88032FBC3EA9-6D29-A7E9-DC07-B84073A851C0.flv

================================================================================
http://f.youku.com/player/getFlvPath/sid/134335160910211021209_00/st/flv/fileid/03000205004CD949A7CBC50215E21DAA6811EC-11DF-380D-A63B-F780E01DF4F9?start=218&K=a12dc5281298552b261c7826&hd=0&myp=0&ts=426

resp info:
Key    Value
Response    HTTP/1.1 302 Found
Via    1.1 SC-SZ-06
Connection    Keep-Alive
Proxy-Connection    Keep-Alive
Content-Length    0
Expires    -1
Date    Fri, 27 Jul 2012 01:13:35 GMT
Location    http://119.167.128.77/youku/697706F04E03882535BA2E2A4D/03000205004CD949A7CBC50215E21DAA6811EC-11DF-380D-A63B-F780E01DF4F9.flv?start=218
Content-type    text/html
Server    F_LIGHTY_TJ1
Cache-Control    private, max-age=0
Pragma    no-cache

================================================================================
http://119.167.128.77/youku/697706F04E03882535BA2E2A4D/03000205004CD949A7CBC50215E21DAA6811EC-11DF-380D-A63B-F780E01DF4F9.flv?start=218

================================================================================

================================================================================

================================================================================
http://stat.youku.com/player/addPlayerDynamicReport
post data:
videoid=55313411&speed=0&sid=134335160910211021209&time=1343351609&segid=1&starttime=218&ikuflag=n1&code=3001

 

================================================================================

================================================================================

================================================================================

================================================================================

================================================================================

================================================================================

 

 


有空再分别搜索:

http://stat.youku.com/player/addPlayerDurationReport
http://stat.youku.com/player/addPlayerStaticReport
http://stat.youku.com/player/addPlayerDynamicReport

去找相关帖子看看。

 

【总结】

上面的一堆分析内容,懒得详细解释了。

总结目前的最新的结果是:

目前已经实现的是对于上述的各个url的访问,其中包括:

http://stat.youku.com/player/addPlayerDurationReport
http://stat.youku.com/player/addPlayerStaticReport
http://stat.youku.com/player/addPlayerDynamicReport

但是其中很多url的的访问过程中的有些参数,还是无法模拟。

其中觉得想要模拟视频播放的话,最核心的应该是addPlayerDurationReport,addPlayerStaticReport,addPlayerDynamicReport这三者。

但是问题就在于,对这三个url的模拟,其中部分参数还无法正确获得。

不过倒是有点奇怪的是,好像在部分参数不完全正确的情况下,对应模拟访问url所返回的response的内容,倒是很正常,感觉像是模拟成功了。

但是很郁闷的是,最终的视频播放次数,始终却没有变,所以目前的结果还是无法成功模拟刷新视频播放。

值得一提的是,网上很多人讨论的,其花很多精力才能何获得的,优酷视频的flv地址,此处倒是很容易就搞定的。

 

下面列举目前仍有疑问的地方:

1. http://stat.youku.com/player/addPlayerStaticReport

的post data是:
url=http%3A%2F%2Fv%2Eyouku%2Ecom%2Fv%5Fshow%2Fid%5FXMjIxMjUzNjQ0%2Ehtml
&videoid=55313411
&referer=null
&uid=0
&source=video
&totalseg=5
&totalsec=1817
&h=IklqiXnhemaZCw9H
&fullflag=0
&ikuflag=n1
&t=AQ7NejIjUnJDYxcBS%2D47NA
&sid=134371001777317737738

其中不清楚的是:

(1)h=IklqiXnhemaZCw9H

此h值,应该是swf播放器内部代码用某种算法算出来的,至今无从获得,所以没办法模拟。

基本清楚的是

(1)sid的值

网上有相关讨论:

http://www.pocketdigi.com/20111108/572.html

http://3shi.net/analyze-youku-video-address/

其中介绍了如何计算sid,但是发现,目前该算法不是很正确,经过研究,目前自己所推测的算法,用C#实现如下:

private string genSid()
{
    string sidStr = "";

    //134330543 0 489 1 489 9547
    //134370055 5 121 1 121 5917
    //134371001 7 773 1 773 7738
    //134371040 7 721 1 721 8303

    double curSecDouble = crl.getCurTimeInSec();                    //1343740056.0327244
    double curSecDoubleFloor = Math.Floor(curSecDouble);            //1343740056.0
    string curSecDoubleFloorStr = curSecDoubleFloor.ToString();     //1343740056
    string lastThreeChars = curSecDoubleFloorStr.Substring(curSecDoubleFloorStr.Length - 3);//056
    Random rdm = new Random();
    int randFourDigitInt = rdm.Next(10000);//4420
    string randomFourDigitStr = randFourDigitInt.ToString();//4420
    sidStr = curSecDoubleFloorStr + "1" + lastThreeChars + randomFourDigitStr;

    return sidStr;
}

剩下的参数,都是很容易从前面相关内容中提取出来,不多细说。

2.addPlayerDurationReport中的一些参数

http://stat.youku.com/player/addPlayerDurationReport?format=0&winType=1&url=http%3A%2F%2Fv%2Eyouku%2Ecom%2Fv%5Fshow%2Fid%5FXMjIxMjUzNjQ0%2Ehtml&rnd=2938&playComplete=0&ct=t&referUrl=null&source=video&cs=251&emb=AjU1MzEzNDExAnYueW91a3UuY29tAnZfc2hvdy9pZF9YTWpJeE1qVXpOalEwLmh0bWw%3D&currentPlayTime=550%2E267&hd=0&continuationPlay=1&topHdVideo=0&videoid=55313411&videoOwnerId=34988573&viewUserId=0&guid=5d174bc8%2Daac4%2D9053%2Dd8b3%2D0553E6F794e3&Type=0&showid%5Fv2=&totalsec=1817&Tid=0&fullflag=0&ikuflag=n&starttime=0&number=59&timestamp=1343710019932&sid=134371001777317737738

可分割为:

http://stat.youku.com/player/addPlayerDurationReport

?format=0

&winType=1

&url=http%3A%2F%2Fv%2Eyouku%2Ecom%2Fv%5Fshow%2Fid%5FXMjIxMjUzNjQ0%2Ehtml

&rnd=2938

&playComplete=0

&ct=t

&referUrl=null

&source=video

&cs=251

&emb=AjU1MzEzNDExAnYueW91a3UuY29tAnZfc2hvdy9pZF9YTWpJeE1qVXpOalEwLmh0bWw%3D

&currentPlayTime=550%2E267

&hd=0

&continuationPlay=1

&topHdVideo=0

&videoid=55313411

&videoOwnerId=34988573

&viewUserId=0

&guid=5d174bc8%2Daac4%2D9053%2Dd8b3%2D0553E6F794e3

&Type=0

&showid%5Fv2=

&totalsec=1817

&Tid=0

&fullflag=0

&ikuflag=n

&starttime=0

&number=59

&timestamp=1343710019932

&sid=134371001777317737738

其中,不清楚的是:

(1)emb

对于emb的值,经多次测试,同一视频的emb的值是固定的,

但是却不知道算法。看起来是从swf播放器中,用某算法所算出来的。

(2)guid

guid也类似于emb,同一视频都是固定的值,但是不知道算法。

(2)number

对于同一视频,多次播放,都是59

所以看起来是对统一视频,此值是固定的,但是不值得如何算出来的。

 

其他的都是清楚的,其中:

(1)currentPlayTim

表示当前播放时间,

经过修改后,下次再通过浏览器打开优酷视频后,会提示

优酷记忆您上次播放到 XX:XX

对应的XX:XX 就是上述值对对应的时间和秒的值。

(2)sid

此sid的值,要和之前addPlayerStaticReport中的一致。

(3)timestamp

timestamp的值是当前时间,正常的话,也是应该比sid中的前半段的时间戳要大的。因为sid是之前生成的,timestamp是现在生成的。

 

3.http://stat.youku.com/player/addPlayerDynamicReport

多次的post data分别为:

starttime=124&segid=2&videoid=55313411&time=1343710407&ikuflag=n1&speed=0&sid=134371040772117218303&code=3001

starttime=0&segid=3&videoid=55313411&time=1343710407&ikuflag=n1&speed=0&sid=134371040772117218303&code=3001

starttime=124&segid=2&videoid=55313411&time=1343710407&ikuflag=n1&speed=545667&sid=134371040772117218303&code=3002

第一次的,分割为:

starttime=124

&segid=2

&videoid=55313411

&time=1343710407

&ikuflag=n1

&speed=0

&sid=134371040772117218303

&code=3001

其中不清楚的是:

(1)starttime和segid

只是猜测是,指定某段中然后对应的起始时间。

具体关系,没深入研究。

(2)code

一般为3001,有的是3002

(3)speed

一般为0,有时候非0。不知道如何计算。

 

其他参数都基本清楚含义。

 

终上所述,虽然可以模拟访问这三个核心的http的GET和POST,但是个别参数,(可能是核心参数,也可能无关紧要)不清楚算法,但是呢,却也可以获得服务器正确的响应,response看起来都很正常。

但是的但是,最后结果却是,无法让播放次数正增加,无法刷新优酷视频的播放次数。

(虽然额外收获是,可以通过后续http访问去获得对应的flv真实地址并且可以下载)

 

总之,期待高手来解决:

1.如何计算上述那些不清楚的参数?(相关算法是啥?)

2.到底对于刷新播放次数,哪些http的请求,才是最核心最关键的,到底是不是上述所猜测的addPlayerStaticReport,addPlayerDurationReport,addPlayerDynamicReport?

 

【题外话】

无意中找到有高手写的两个python脚本:

发两个Python脚本:迅雷离线下载和优酷视频下载

有空可以去试试:

迅雷离线下载

优酷视频下载

 

【后记 2012-11-12】

虽然没有完成最终目的,不过也还是可以提供已实现的代码的下载的:

完整的VS2010的C#项目源码下载:accessYouku_2012-07-31.7z

转载请注明:在路上 » 【未解决】模拟优酷视频播放,刷新播放次数 + 【虽然已实现】获得优酷视频flv播放地址并可下载

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.177 seconds, using 22.13MB memory