Skip to content

Instantly share code, notes, and snippets.

/fetfet.rb Secret

Created August 24, 2015 21:11
Show Gist options
  • Save anonymous/304c264127ec9185d02c to your computer and use it in GitHub Desktop.
Save anonymous/304c264127ec9185d02c to your computer and use it in GitHub Desktop.
require 'nokogiri'
require 'mechanize'
agent = Mechanize.new
agent.get('https://fetlife.com/login')
agent.page.form.nickname_or_email = "el_rubio"
agent.page.form.password = "ruby@2015"
agent.page.form.submit
agent.page.link_with(:text => 'Porto').click
agent.page.link_with(:text => /(view more).+/).click
#parsy
noko = agent.page.parser
parsu = noko.css('.clearfix .user_in_list')
parsu.each do | noko |
user = noko.at_css('span').text
age = noko.at_css('.span-8 .quiet').text.to_s.split(' ')[0].to_s.delete('^0-9')
sex = noko.at_css('.span-8 .quiet').text.to_s.split(' ')[0].to_s.delete('0-9')
url = noko.at_css('a')['href']
img = noko.at_css('img')['src']
type = noko.at_css('.span-8 .quiet').text.to_s.split(' ')[1].to_s
puts user
puts age
puts sex
puts url
puts img
puts type
end
agent.page.link_with(:text => /(Next).+/).click
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment