Advertisement
Guest User

Untitled

a guest
Dec 16th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. URL: http://www.adecco.co.uk/careercentre/job-search-results.aspx?kws=&pstc=&cty=&prvnm=&pdx=1
  2.  
  3.  
  4. agent = Mechanize.new
  5. page = agent.get('http://www.adecco.co.uk/careercentre/job-search-results.aspx?kws=&pstc=&cty=&prvnm=&pdx=1')
  6. puts page.body
  7.  
  8. require 'mechanize'
  9. require 'nokogiri'
  10.  
  11. agent = Mechanize.new
  12. page = agent.get('http://www.adecco.co.uk/careercentre/job-search-results.aspx?kws=&pstc=&cty=&prvnm=&pdx=1')
  13.  
  14. document = Nokogiri::HTML(page.content)
  15. puts document
  16.  
  17. a = Mechanize.new
  18. a.user_agent_alias = 'Mac Safari'
  19.  
  20. AGENT_ALIASES = {
  21. 'Windows IE 6' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
  22. 'Windows IE 7' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
  23. 'Windows Mozilla' => 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6',
  24. 'Mac Safari' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; de-at) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10',
  25. 'Mac FireFox' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6',
  26. 'Mac Mozilla' => 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4a) Gecko/20030401',
  27. 'Linux Mozilla' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624',
  28. 'Linux Firefox' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.1) Gecko/20100122 firefox/3.6.1',
  29. 'Linux Konqueror' => 'Mozilla/5.0 (compatible; Konqueror/3; Linux)',
  30. 'iPhone' => 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3',
  31. 'Mechanize' => "WWW-Mechanize/#{VERSION} (http://rubyforge.org/projects/mechanize/)"
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement