GitXplorerGitXplorer
t

lonely_coder

public
52 stars
18 forks
8 issues

Commits

List of commits on branch master.
Unverified
58207458e810b2402dd6bfba342522b76bde76ec

Merge pull request #10 from davidgibbons/master

ttrek committed 10 years ago
Unverified
98bc74d14be48f04bb23c764fedc457147e52b5a

Fix empty spaces at the end of lines and on empty lines, fixed profile modules with addition of relationship status and relationship type

committed 10 years ago
Unverified
d51721a27b3f9e69945bb3dac186ff89fc1ef786

Merge branch 'master' of github.com:trek/lonely_coder

ttrek committed 11 years ago
Unverified
e5b7cf12c20454f6d66bf016e6c56a0d756a48df

add MIT license

ttrek committed 11 years ago
Unverified
75397359c9ecb1b01e73dcc915a5edb3d5a4dba7

Merge pull request #7 from hueykwik/bug/readme

ttrek committed 11 years ago
Unverified
99552e57b5acc4b02e40dd29ceb8d9d6bc1bb69e

Fixes typo in README sample code.

committed 11 years ago

README

The README file for this repository.

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) # ♥