Advertisement
Guest User

Untitled

a guest
Nov 6th, 2017
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use WWW;
  2. use DOM::Tiny;
  3. use Text::CSV;
  4. use URI::Encode;
  5. use HTTP::UserAgent;
  6.  
  7. constant OUT_FILE = 'results3.txt'.IO;
  8.  
  9. my $term = uri_encode "Cancer";
  10.  
  11. say "Searching for: $term";
  12. for 1990..1990 -> $year {
  13. print "\t...year $year ";
  14. "temp".IO.spurt: get "https://patents.google.com/xhr/query?url=q%3D{$term}%26country%3DUS%26before%3Dfiling%3A{$year}1231%26after%3Dfiling%3A{$year}0101&exp=&download=true";
  15. #"temp".IO.spurt: get "https://patents.google.com/?q=Cancer&country=US&before=19901231&after=19900101", User-Agent => 'Test/5.0';
  16. my $results-num = csv(:in<temp>).elems - 2;
  17. say $results-num;
  18. OUT_FILE.spurt: :append, "$term,$year,$results-num\n";
  19. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement