Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- $|=1;
- while (<>) {
- @X = split;
- if ($X[0] =~ m/^http.*/) {
- $url = $X[0];
- $referer = $X[1];
- $urlreferer = $X[0] ." ". $X[1];
- } else {
- $chanel = $X[0];
- $url = $X[1];
- $referer = $X[2];
- $urlreferer = $X[1] ." ". $X[2];
- }
- #youtube all version
- if ($url=~ m/^https?\:\/\/.*(youtube|googlevideo|videoplayback)/){
- if ($url=~ m/^https?\:\/\/.*googlevideo.*videoplayback.*/){
- @cpn = m/[=%&?\/]cpn[=%&?\/]([^\&\s]*)/;
- @id = m/[=%&?\/]id[=%&?\/]([^\&\s]*)/;
- @itag = m/[=%&?\/]itag[=%&?\/]([\d]*)/;
- @range = m/[=%&?\/]range[=%&?\/]([\d]*-[\d]*)/;
- @mime = m/[=%&?\/]mime[=%&?\/]([^\&\s]*)/;
- if ($referer=~ m/^*https?\:\/\/www\.youtube\.com\/(watch\?v|embed|v)[=%&?\/]([^\&\s\?]*)/){
- @id = $2;
- } else {
- if (defined(@cpn)){
- if (-e "/tmp/@cpn"){
- open FILE, "/tmp/@cpn";
- @id = <FILE>;
- close FILE;}
- }
- }
- $out="OK store-id=http://squid/googlevideo/youtube/id=@id/itag=@itag/mime=@mime/range=@range";
- #ads youtube
- } elsif ($url=~ m/^https?\:\/\/.*youtube.*api.*stats.*ads.*/){
- @content_v = m/[=%&?\/]content_v[=%&?\/]([^\&\s]*)/;
- unless (-e "/tmp/@cpn"){
- open FILE, ">/tmp/@cpn";
- print FILE @content_v;
- close FILE;
- }
- #tracking youtube
- } elsif ($url=~ m/^https?\:\/\/.*youtube.*(ptracking|set_awesome).*/){
- @video_id = m/[=%&?\/]video_id[=%&?\/]([^\&\s]*)/;
- unless (-e "/tmp/@cpn"){
- open FILE, ">/tmp/@cpn";
- print FILE @video_id;
- close FILE;
- }
- #stream_204 youtube
- } elsif ($url=~ m/^https?\:\/\/.*youtube.*(stream_204|watchtime|qoe|atr).*/){
- @docid = m/[=%&?\/]docid[=%&?\/]([^\&\s]*)/;
- unless (-e "/tmp/@cpn"){
- open FILE, ">/tmp/@cpn";
- print FILE @docid;
- close FILE;
- }
- #player_204 youtube
- } elsif ($url=~ m/^https?\:\/\/.*youtube.*player_204.*/){
- @v = m/[=%&?\/]v[=%&?\/]([^\&\s]*)/;
- unless (-e "/tmp/@cpn"){
- open FILE, ">/tmp/@cpn";
- print FILE @v;
- close FILE;
- }
- }
- } else {
- $out="ERR";
- }
- if ($X[0] =~ m/^http.*/) {
- print "$out\n";
- } else {
- print "$chanel $out\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement