Youku video address

Source: Internet
Author: User

Youku has a unique ID for each video. This ID can be obtained when you view the source file on the page,
The following uses videoid = 4579646 as an example.

1. After the flvplayer load is complete, it will request the playback list of this ID from the background. The request address is as follows:
Http://v.youku.com/player/getPlayList/VideoIDS/4579646

Modify videoid to obtain the playback list of any video.
This request returns a JSON object that stores the video playback list and video address decryption method.

2. video address decryption parameters in the JSON object

"Seed": 6064,
"Fileid ": "34*56*56*31*34*32*67*7*34*34*6*31*4*67*46*32*0*29*56*4*32*10*34*34*29*67*3*10*29*29*31*10*29*4*34*56*7*62*18*5*31*34*6*18*56*62*4*32*18*5*55*32*0*18*46*31*55*67*46*3*4*62*34*10*62*56 *"

"Key1": "bd7e2210 ",
"Key2": "a4b19712badcd042"

The following is the "look" of the video address ":
Http://f.youku.com/player/getFlvPath/sid/123122029188218825571_00

/ST/FLV/fileid/02006401004962dc0f6102007fc5984715ce4e-d1fc-1363-8681-abdc115158da? K = 206c9dcb7e2eb9a614fa7e0

The red part varies according to the video and request time.
The blue part indicates the sequence number of the video file (hexadecimal). If a video file is divided into 11 parts, you only need to change the blue part from 00 to 0a.

Sid:Java code
 

  1. Private string getsid (){
  2. String SID = new date (). gettime () + ""
  3. + (1000 + new random (). nextint (999) + ""
  4. + (New random (). nextint (9000) + 1000 );
  5. Return Sid;
  6. }
Private string getsid () {string SID = new date (). gettime () + "" + (1000 + new random (). nextint (999) + "" + (new random (). nextint (9000) + 1000); Return Sid ;}

The first half of the Sid is obtained, and the sequence number of the video file is added.

Fileid:

Java code
 
  1. /*
  2. The fileid seed parameter is provided in the preceding JSON object.
  3. */
  4. Private string getfileid (string fileid, int seed ){
  5. String mixed = getmixstring (SEED );
  6. String [] IDs = fileid. Split ("\\*");
  7. String realid = "";
  8. For (INT I = 0; I <IDs. length; ++ I ){
  9. Int idx = integer. parseint (IDs [I]);
  10. Realid + = mixed. charat (idx );
  11. }
  12. Return realid;
  13. }
  14. Private string getmixstring (INT seed ){
  15. String mixed = "";
  16. String source = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/\:. _-1234567890 ";
  17. Int Len = source. Length ();
  18. For (INT I = 0; I <Len; ++ I ){
  19. Seed = (seed * 211 + 30031) % 65536;
  20. Int Index = (INT) (seed/65536d * Source. Length ());
  21. Char c = source. charat (INDEX );
  22. Mixed = mixed + C;
  23. Source = source. Replace (C + "","");
  24. }
  25. Return mixed;
  26. }
/* The fileid seed parameter is provided for the JSON object mentioned above. */Private string getfileid (string fileid, int seed) {string mixed = getmixstring (SEED); string [] IDs = fileid. split ("\ *"); string realid = ""; for (INT I = 0; I <IDs. length; ++ I) {int idx = integer. parseint (IDs [I]); realid + = mixed. charat (idx);} return realid;} private string getmixstring (INT seed) {string mixed = ""; string source = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz /\\:. _-1234567890 "; int Len = source. length (); For (INT I = 0; I <Len; ++ I) {seed = (seed * 211 + 30031) % 65536; int Index = (INT) (seed/65536d * Source. length (); char c = source. charat (INDEX); mixed = mixed + C; Source = source. replace (C + "", "");} return mixed ;}

Then, change the 9-and 10-bit (non-array-bit) values of the obtained fileid to the video file sequence number (same as the suffix of seed ).

Key:Java code
 

  1. Private string getkey (string key1, string key2 ){
  2. Int appendkey = util. hexstring2int (key1 );
  3. Appendkey ^ = 0xa55aa5a5;
  4. Return key2 + integer. tohexstring (appendkey );
  5. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.