Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.
/ lonely_coder Public archive

Interact with OKCupid through Ruby

License

Notifications You must be signed in to change notification settings

trek/lonely_coder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lonely Coder

,d88b.d88b,
88888888888
`Y8888888Y'
  `Y888Y'
    `Y'

Lonely coder seeks nice boy

require 'lonely_coder'
okc = OKCupid.new('thetrek','thisisntmypasswordweirdo')

sweet_guys = []

['Ann Arbor, MI', 'New York, New York',
'Chicago, Illinois', 'San Francisco, CA'].each do |maybe_here|
  sweet_guys += okc.search({
    :min_age => 25,
    :max_age => 35, # just someone around my age, yo
    :gentation => 'Guys who like guys', # don't hate
    :order_by => 'Match %', # I want us to get along, let's make it last
    :last_login => 'last month',
    :location => maybe_here,
    :radius => 25, # acceptable values are 25, 50, 100, 250, 500, nil
    :require_photo => true, # I like a goofy smile
    :relationship_status => 'single' # the heart aches, but not for friends
  }).results
end

sweet_guys.count # oof, 812. Let the coffee dates begin!

What is this nonsense?

A ruby gem for interacting with OKCupid. OKCupid doesn't actually have an API, so we use mechanize to interact with the site. Screen scraping isn't terribly fast, but it's pretty zippy compared to the other option – doing nothing.

How does it work?

You'll need an OKCupid account (it's free) because most of the site is behind authentication. You can create a new connection to the site.

Install as a gem

gem install lonely_coder

Use your account

require 'lonely_coder'
okc = OKCupid.new('yourusername', 'yourpassword')

Once you have a connection you can check out a person's profile

trek = okc.profile_for('thetrek')
trek.match # => 99. Damn, he's pretty sweet
trek.location # => 'Ann Arbor, Michigan'
`open #{trek.profile_thumb_urls.first}` # HOT. DAMN.

Go ahead and ask for username, match, friend, enemy, location, age, sex, orientation, relationship_status, relationship_type, last_online, ethnicity, height, body_type, diet, smokes, drinks, drugs, religion, sign, education, job, income, offspring, pets, speaks, and profile_thumb_urls

If you don't have particular username in mind, you can search. Check lib/magic_constants.rb for the crazy [Magic Numbers](http://en.wikipedia.org/wiki/Magic_number_(programming\)).

search = okc.search({
  :min_age => 18,
  :max_age => 99,
  :gentation => 'guys who like guys',
  :ethnicity => ['human']
}) # search object

# fires the loading of the first 10, but only limited profiles. If you'd like full
# deets, use okc.profile_for with a results username.
search.results
search.load_next_page # loads the next 10 results

What if things don't go well

okc.love(1000) # ♥

About

Interact with OKCupid through Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages