Advertisement
ujiajah1

youtube store-id

Jul 27th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.07 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. $|=1;
  4. while (<>) {
  5. @X = split;
  6. if ($X[0] =~ m/^http.*/) {
  7.     $url        = $X[0];
  8.     $referer    = $X[1];
  9.     $urlreferer = $X[0] ." ". $X[1];   
  10. } else {
  11.     $chanel     = $X[0];
  12.     $url        = $X[1];
  13.     $referer    = $X[2];
  14.     $urlreferer = $X[1] ." ". $X[2];
  15. }
  16.  
  17.  
  18. #youtube all version
  19. if ($url=~ m/^https?\:\/\/.*(youtube|googlevideo|videoplayback)/){
  20.     if ($url=~ m/^https?\:\/\/.*googlevideo.*videoplayback.*/){
  21.         @cpn    = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
  22.         @id     = m/[=%&?\/]id[=%&?\/]([^\&\s]*)/;
  23.         @itag   = m/[=%&?\/]itag[=%&?\/]([\d]*)/;
  24.         @range  = m/[=%&?\/]range[=%&?\/]([\d]*-[\d]*)/;
  25.         @mime   = m/[=%&?\/]mime[=%&?\/]([^\&\s]*)/;
  26.         if ($referer=~ m/^*https?\:\/\/www\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
  27.             @id     = $2;
  28.         } else {
  29.             if (defined(@cpn)){
  30.                 if (-e "/tmp/@cpn"){
  31.                     open FILE, "/tmp/@cpn";
  32.                     @id = <FILE>;
  33.                     close FILE;}
  34.                 }
  35.             }  
  36.     $out="OK store-id=http://squid/googlevideo/youtube/id=@id/itag=@itag/mime=@mime/range=@range";
  37.  
  38.     #ads youtube
  39.     } elsif ($url=~ m/^https?\:\/\/.*youtube.*api.*stats.*ads.*/){
  40.         @content_v  = m/[=%&?\/]content_v[=%&?\/]([^\&\s]*)/;
  41.         unless (-e "/tmp/@cpn"){
  42.             open FILE, ">/tmp/@cpn";
  43.             print FILE @content_v;
  44.             close FILE;
  45.         }
  46.  
  47.     #tracking youtube
  48.     } elsif ($url=~ m/^https?\:\/\/.*youtube.*(ptracking|set_awesome).*/){
  49.         @video_id   = m/[=%&?\/]video_id[=%&?\/]([^\&\s]*)/;
  50.         unless (-e "/tmp/@cpn"){
  51.             open FILE, ">/tmp/@cpn";
  52.             print FILE @video_id;
  53.             close FILE;
  54.         }
  55.  
  56.     #stream_204 youtube
  57.     } elsif ($url=~ m/^https?\:\/\/.*youtube.*(stream_204|watchtime|qoe|atr).*/){
  58.         @docid  = m/[=%&?\/]docid[=%&?\/]([^\&\s]*)/;
  59.         unless (-e "/tmp/@cpn"){
  60.             open FILE, ">/tmp/@cpn";
  61.             print FILE @docid;
  62.             close FILE;
  63.         }
  64.  
  65.     #player_204 youtube
  66.     } elsif ($url=~ m/^https?\:\/\/.*youtube.*player_204.*/){
  67.         @v      = m/[=%&?\/]v[=%&?\/]([^\&\s]*)/;
  68.         unless (-e "/tmp/@cpn"){
  69.             open FILE, ">/tmp/@cpn";
  70.             print FILE @v;
  71.             close FILE;
  72.         }
  73.     }
  74. } else {
  75.     $out="ERR";
  76. }
  77.  
  78. if ($X[0] =~ m/^http.*/) {
  79.     print "$out\n";
  80. } else {
  81.     print "$chanel $out\n";
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement