Tinder client library for elixir. It uses HTTPoison to call Tinder's private API.
Refer to lib/extinder.ex and test/extinder_test.exs for available functions and examples.
If available in Hex, the package can be installed as:
-
Add extinder to your list of dependencies in
mix.exs
:def deps do [{:extinder, "~> 0.3.0"}] end
-
Ensure extinder is started before your application:
def application do [applications: [:extinder]] end
Before using ExTinder, you must grab your Facebook OAuth token. ExTinder.FacebookAuthorizer makes use of Hound which supports Selenium, PhantomJS, and ChromeDriver. PhantomJS still shares one cookiejar across sessions so I prefer Selenium.
First install Selenium.
brew update
brew install selenium-server-standalone
Run Selenium.
selenium-server -p 4444
Add your preferred driver or browser to your config.exs.
config :hound, driver: "selenium"
You can now use ExTinder.FacebookAuthorizer to grab your Facebook OAuth token.
facebook_token = ExTinder.FacebookAuthorizer.get_token("[email protected]", "mypassword")
You can also use it to get your Facebook ID from your profile url.
facebook_id = ExTinder.FacebookAuthorizer.get_id("http://facebook.com/datboi")
If necessary, the request to facebook can also be made through a proxy. You can create a proxy using ExTinder.Model.Proxy.create and pass it to the FacebookAuthorizer. The proxy constructor takes a type and proxy string along with an optional username and password. For more information check out the docs in lib/elixir/model.ex
The proxy types supported are ["ftp", "http", "ssl", "socks", "all"]
If you want to use proxies that require authorization they must be SOCKS.
# Proxies not requiring authorization
proxy = ExTinder.Model.Proxy.create("all", "200.54.110.196:80")
facebook_token = ExTinder.FacebookAuthorizer.get_token("[email protected]", "mypassword", proxy)
# Socks proxies requiring authorization
proxy = ExTinder.Model.Proxy.create("all", "200.54.110.196:80", "my_proxy_username", "my_proxy_password")
facebook_token = ExTinder.FacebookAuthorizer.get_token("[email protected]", "mypassword", proxy)
This can then be used with your facebook profile id to get the necessary Tinder OAuth token.
token = ExTinder.authenticate("myfacebookid", facebook_token)
If your not in the mood for additional dependencies you can also get your Facebook OAuth token manually. The easiest way is to follow this link and read the facebook token from url you get redirected to.
If you don't know how to find your facebook id you can find it here.
Now that you have your facebook id and token you can get an OAuth token from Tinder:
token = ExTinder.authenticate("myfacebookid", "myfacebooktoken")
Most requests to Tinder's API will require your previously obtained oauth token.
Get nearby user ids:
token
|> ExTinder.get_nearby_users
|> Enum.map(fn(r) -> r._id end)
Like a user (swipe right):
token
|> ExTinder.like("somematchid")
Send a message to a match:
token
|> ExTinder.send_message("userid", "dang girl is yr father a lobster?")
You can pass an ExTinder.Model.Proxy to any of the client functions and it will be used to make the request. There is more information on using proxies above in the Hound authentication section.
proxy = ExTinder.Model.Proxy.create("all", "69.69.69.69:3128")
token = ExTinder.authenticate("myfacebookid", "myfacebooktoken", proxy)
token
|> ExTinder.like("somematchid", proxy)
You can use ExTinder's request function to query the API for functionality not yet implemented. You can make both authenticated and unauthenticated GET and POST requests by passing the correct tuple to request.
Unauthenticated GET request:
ExTinder.request({:get, "secret/route"})
Authenticated GET request:
ExTinder.request({:get, "secret/route", "myoauthtoken"})
Unauthenticated POST request:
ExTinder.request({:post, "secret/route", %{my: body}})
Authenticated POST request:
ExTinder.request({:post, "secret/route", %{my: body}, "myoauthtoken"})