The project uses temporary write. To be improved ** obtain the swf playback address of Youku and Tudou based on the user-submitted (swfhtml) address ** privatefunction_getSwf ($ url & amp; 39; & amp; 39 ;) {if (
- The project uses temporary write. To be improved
- /*
- * Obtain the swf playback address of Youku and Tudou based on the (swf/html) address submitted by the user.
- **/
- Private function _ getSwf ($ url = ''){
- If (isset ($ url )&&! Emptyempty ($ url )){
- Preg_match_all ('/http ://(.*?)?. (.*?)?. Com/(. *)/', $ url, $ types );
- } Else {
- Return false;
- }
- $ Type = $ types [2] [0];
- $ Domain = $ types [1] [0];
- $ Isswf = strpos ($ types [3] [0], 'v.swf ') === false? False: true;
- $ Method = substr ($ types [3] [0], 0, 1 );
- Switch ($ type ){
- Case 'youku ':
- If ($ domain = 'player '){
- $ Swf = $ url;
- } Else if ($ domain = 'V '){
- Preg_match_all ('/http://v.youku.com/v_show/id (.*)?. Html/', $ url, $ url_array );
- $ Swf = 'http: // player.youku.com/player.php/sid/'.str_replace ('/', '', $ url_array [1] [0]). '/v.swf ';
- } Else {
- $ Swf = $ url;
- }
- Break;
- Case 'tuu ':
- If ($ isswf ){
- $ Swf = $ url;
- } Else {
- $ Method = 'p '? 'V': $ method;
- Preg_match_all ('/http://www.tudou.com /(.*)? /(.*)? /', $ Url, $ url_array );
- $ Str_arr = explode ('/', $ url_array [1] [0]);
- $ Count = count ($ str_arr );
- If ($ count = 1 ){
- $ Id = explode ('.', $ url_array [2] [0]) [0];
- } Else if ($ count = 2 ){
- $ Id = $ str_arr [1];
- } Else if ($ count = 3 ){
- $ Id = $ str_arr [2];
- }
- $ Swf = 'http: // www.tudou.com/'.w.method.'/'.mongoid.'/v.swf ';
- }
- Break;
- Default:
- $ Swf = $ url;
- Break;
- }
- Return $ swf;
- }