url: http://paste.minad.de/index.php?nid=400
Notizname: citeonline.pl von: rellig Sprache:

  1. #!/usr/bin/perl -w
  2. use strict;
  3.  
  4. require LWP::UserAgent;
  5.  
  6. # --- config
  7. my $year = "2014";
  8. my $month = "07";
  9. # --- endconfig
  10.  
  11. my $ua = LWP::UserAgent->new;
  12. $ua->timeout(10);
  13. $ua->env_proxy;
  14.  
  15. while(@ARGV) {
  16.  
  17. my $url = shift(@ARGV);
  18. my $author = " ";
  19.  
  20. if (not $url =~ m/^http[s]?/) {
  21. $url = "http://$url";
  22. }
  23.  
  24. if ($url =~ m#(.*\.)?([\w\d]+)\.[\w]{1,4}(/.*)?#) {
  25. $author = $2;
  26. }
  27.  
  28. my $response = $ua->get($url);
  29.  
  30. if ($response->is_success) {
  31. print '@online'."{,
  32. author = {$author},
  33. title = {".$response->title()."},
  34. month = {$month},
  35. year = {$year},
  36. url = {$url}
  37. }\n\n";
  38. }
  39. else {
  40. print $response->status_line." - $url \n\n";
  41. }
  42. }
Pastelog:
erstellt 2014.07.23 17:47:54
Hits
652




© 2009-2010 rellig