Advertisement
Guest User

Untitled

a guest
Jun 29th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. puts "AngryAngry Spider v0.1"
  2. puts "Url ripping started"
  3.  
  4. inital_url = "www.google.com"
  5. port = 80
  6. start_page="/index.html"
  7.  
  8. stripped_links[]
  9.  
  10. request = "GET #{start_page} HTTP/1.0\r\n\r\n"
  11.  
  12. spider = TCPSocket.open(host, port)
  13. spider.print(request)
  14.  
  15. initial_page = spider.read
  16.  
  17. headers,body = initial_page.split("\r\n\r\n", 2)
  18.  
  19. i = 0
  20.  
  21. for webpage.scan(/http:\/\/\w+/).each |link|
  22.  
  23. stripped_links[i] = link
  24. puts link
  25. i = i + 1
  26.  
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement