3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace ZarkielMedia; class Youtube{ private $videoMap = array( "13" => array("3GP", "Low Quality - 176x144"), "17" => array("3GP", "Medium Quality - 176x144"), "36" => array("3GP", "High Quality - 320x240"), "5" => array("FLV", "Low Quality - 400x226"), "6" => array("FLV", "Medium Quality - 640x360"), "34" => array("FLV", "Medium Quality - 640x360"), "35" => array("FLV", "High Quality - 854x480"), "43" => array("WEBM", "Low Quality - 640x360"), "44" => array("WEBM", "Medium Quality - 854x480"), "45" => array("WEBM", "High Quality - 1280x720"), "18" => array("MP4", "Medium Quality - 480x360"), "22" => array("MP4", "High Quality - 1280x720"), "37" => array("MP4", "High Quality - 1920x1080"), "38" => array("MP4", "High Quality - 4096x230") ); private $videoPageUrl = 'http://www.youtube.com/watch?v='; protected function getPageContent($id){ $page = $this->videoPageUrl.$id; $content = file_get_contents($page); return $content; } function getDownloadLinks($id){ $content = $this->getPageContent($id); $videos = array('MP4' => array(), 'FLV' => array(), '3GP' => array(), 'WEBM' => array()); if(preg_match('/"url_encoded_fmt_stream_map": "(.*)"/iUm', $content, $r)){ $data = $r[1]; $data = explode(',', $data); foreach($data As $cdata){ $cdata = str_replace('u0026', '&', $cdata); $cdata = explode('&', $cdata); foreach($cdata As $xdata){ if(preg_match('/^sig/', $xdata)){ $sig = substr($xdata, 4); } if(preg_match('/^url/', $xdata)){ $url = substr($xdata, 4); } if(preg_match('/^itag/', $xdata)){ $type = substr($xdata, 5); } } $url = urldecode($url).'&signature='.$sig; $videos[$this->videoMap[$type][0]][$this->videoMap[$type][1]] = $url; } } return $videos; } } $youtube = new ZarkielMediaYoutube(); $download_links = $youtube->getDownloadLinks('q_gfD3nvh-8'); print_r($download_links);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hakoi
function name:  (null)
number of ops:  11
compiled vars:  !0 = $youtube, !1 = $download_links
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   NEW                                              $2      'ZarkielMedia%5CZarkielMediaYoutube'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   69     3        INIT_METHOD_CALL                                         !0, 'getDownloadLinks'
          4        SEND_VAL_EX                                              'q_gfD3nvh-8'
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !1, $5
   70     7        INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cprint_r'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class ZarkielMedia\Youtube:
Function getpagecontent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hakoi
function name:  getPageContent
number of ops:  10
compiled vars:  !0 = $id, !1 = $page, !2 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        FETCH_OBJ_R                                      ~3      'videoPageUrl'
          2        CONCAT                                           ~4      ~3, !0
          3        ASSIGN                                                   !1, ~4
   29     4        INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cfile_get_contents'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !2, $6
   30     8      > RETURN                                                   !2
   31     9*     > RETURN                                                   null

End of function getpagecontent

Function getdownloadlinks:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 83
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 82
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 82
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 65
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 65
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 44
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 54
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 64
Branch analysis from position: 54
Branch analysis from position: 44
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 65
Branch analysis from position: 82
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 82
Branch analysis from position: 83
filename:       /in/hakoi
function name:  getDownloadLinks
number of ops:  85
compiled vars:  !0 = $id, !1 = $content, !2 = $videos, !3 = $r, !4 = $data, !5 = $cdata, !6 = $xdata, !7 = $sig, !8 = $url, !9 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   35     1        INIT_METHOD_CALL                                         'getPageContent'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $10     
          4        ASSIGN                                                   !1, $10
   36     5        ASSIGN                                                   !2, <array>
   38     6        INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cpreg_match'
          7        SEND_VAL_EX                                              '%2F%22url_encoded_fmt_stream_map%22%3A+%22%28.%2A%29%22%2FiUm'
          8        SEND_VAR_EX                                              !1
          9        SEND_VAR_EX                                              !3
         10        DO_FCALL                                      0  $13     
         11      > JMPZ                                                     $13, ->83
   39    12    >   FETCH_DIM_R                                      ~14     !3, 1
         13        ASSIGN                                                   !4, ~14
   40    14        INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cexplode'
         15        SEND_VAL_EX                                              '%2C'
         16        SEND_VAR_EX                                              !4
         17        DO_FCALL                                      0  $16     
         18        ASSIGN                                                   !4, $16
   42    19      > FE_RESET_R                                       $18     !4, ->82
         20    > > FE_FETCH_R                                               $18, !5, ->82
   43    21    >   INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cstr_replace'
         22        SEND_VAL_EX                                              'u0026'
         23        SEND_VAL_EX                                              '%26'
         24        SEND_VAR_EX                                              !5
         25        DO_FCALL                                      0  $19     
         26        ASSIGN                                                   !5, $19
   44    27        INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cexplode'
         28        SEND_VAL_EX                                              '%26'
         29        SEND_VAR_EX                                              !5
         30        DO_FCALL                                      0  $21     
         31        ASSIGN                                                   !5, $21
   46    32      > FE_RESET_R                                       $23     !5, ->65
         33    > > FE_FETCH_R                                               $23, !6, ->65
   47    34    >   INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cpreg_match'
         35        SEND_VAL_EX                                              '%2F%5Esig%2F'
         36        SEND_VAR_EX                                              !6
         37        DO_FCALL                                      0  $24     
         38      > JMPZ                                                     $24, ->44
   48    39    >   INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Csubstr'
         40        SEND_VAR_EX                                              !6
         41        SEND_VAL_EX                                              4
         42        DO_FCALL                                      0  $25     
         43        ASSIGN                                                   !7, $25
   51    44    >   INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cpreg_match'
         45        SEND_VAL_EX                                              '%2F%5Eurl%2F'
         46        SEND_VAR_EX                                              !6
         47        DO_FCALL                                      0  $27     
         48      > JMPZ                                                     $27, ->54
   52    49    >   INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Csubstr'
         50        SEND_VAR_EX                                              !6
         51        SEND_VAL_EX                                              4
         52        DO_FCALL                                      0  $28     
         53        ASSIGN                                                   !8, $28
   55    54    >   INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Cpreg_match'
         55        SEND_VAL_EX                                              '%2F%5Eitag%2F'
         56        SEND_VAR_EX                                              !6
         57        DO_FCALL                                      0  $30     
         58      > JMPZ                                                     $30, ->64
   56    59    >   INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Csubstr'
         60        SEND_VAR_EX                                              !6
         61        SEND_VAL_EX                                              5
         62        DO_FCALL                                      0  $31     
         63        ASSIGN                                                   !9, $31
   46    64    > > JMP                                                      ->33
         65    >   FE_FREE                                                  $23
   59    66        INIT_NS_FCALL_BY_NAME                                    'ZarkielMedia%5Curldecode'
         67        SEND_VAR_EX                                              !8
         68        DO_FCALL                                      0  $33     
         69        CONCAT                                           ~34     $33, '%26signature%3D'
         70        CONCAT                                           ~35     ~34, !7
         71        ASSIGN                                                   !8, ~35
   60    72        FETCH_OBJ_R                                      ~37     'videoMap'
         73        FETCH_DIM_R                                      ~38     ~37, !9
         74        FETCH_DIM_R                                      ~39     ~38, 0
         75        FETCH_OBJ_R                                      ~41     'videoMap'
         76        FETCH_DIM_R                                      ~42     ~41, !9
         77        FETCH_DIM_R                                      ~43     ~42, 1
         78        FETCH_DIM_W                                      $40     !2, ~39
         79        ASSIGN_DIM                                               $40, ~43
         80        OP_DATA                                                  !8
   42    81      > JMP                                                      ->20
         82    >   FE_FREE                                                  $18
   64    83    > > RETURN                                                   !2
   65    84*     > RETURN                                                   null

End of function getdownloadlinks

End of class ZarkielMedia\Youtube.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.32 ms | 1404 KiB | 27 Q