doktersquid

store-id

Mar 29th, 2016
16,865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.23 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # =====================================================
  3. # = DSI store-id sample youtube 2016
  4. # = https://www.facebook.com/R.dhani.dhanu
  5. # = http://www.dokter-squid.com/
  6. # =====================================================
  7.  
  8. $|=1;
  9. while (<>) {
  10. chomp;
  11.  
  12. my $dsi = "";
  13. if (s/^(\d+\s+)//o) { $dsi = $1; }
  14.  
  15. @X = split;
  16. if (@X[0] =~ m/^(exit|quit|x|q)/) {
  17. print STDERR "quiting helper quietly\n";
  18. exit 0;
  19. }
  20. $url = $X[0];
  21. $referer = $X[1];
  22.  
  23. # youtube.com
  24. if ($url =~ m/^https?:\/\/.*\.googlevideo\.com\/videoplayback\?.*/) {
  25.         @id = m/[\&?|\%?|\s?]id=([^\&\%\s]+)/;
  26.         @range = m/[\&?|\%?|\s?]range=([^\&\%\s]+)/;
  27.         @itag = m/[\&?|\%?|\s?]itag=([^\&\%\s]+)/;
  28.         @mime = m/[\&?|\%?|\s?]mime=([^\&\%\s]+)/;
  29.         @clen = m/[\&?|\%?|\s?]clen=([^\&\%\s]+)/;
  30.         if ($referer =~ m/^https?\:\/\/www\.youtube\.com\/(watch\?v\=|embed\/|v\/)(.*)/) {
  31.             $v = $2;
  32.         } else { $v = $id[0] }
  33.         $out = "http://youtube.dokter-squid.com/" . $v . "@range@itag@mime@clen";
  34.  
  35.  
  36. # ytimg.com
  37. } elsif ($url =~ m/^https?:\/\/.*\.ytimg\.com(.*\.(webp|jpg|gif))/) {
  38.     $out = "http://ytimg.dokter-squid.com/$1";
  39.  
  40. } else  {
  41.     $out = "ERR";
  42. }
  43. if ($out =~ m/^http:\/\/.*/) {
  44.     print $dsi, "OK store-id=$out\n";
  45. } else {
  46.     print $dsi, "ERR\n";
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment