Skip to content

Instantly share code, notes, and snippets.

@juliojgarciaperez
Created August 17, 2016 08:06
Show Gist options
  • Save juliojgarciaperez/31ccb391cb1fbcb04dc86a16038fca24 to your computer and use it in GitHub Desktop.
Save juliojgarciaperez/31ccb391cb1fbcb04dc86a16038fca24 to your computer and use it in GitHub Desktop.
require 'mechanize'
require 'pry'
L = 'https://www.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fau' \
'thorize%2F&scope=user_birthday,user_photos,user_education_history,email,user_relatio' \
'nship_details,user_friends,user_work_history,user_likes&response_type=token%2Csigned' \
'_request&client_id=464891386855067'.freeze
USER_AGENT = 'Mozilla/5.0 (Linux; U; en-gb; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML' \
', like Gecko) Silk/3.16 Safari/535.19'.freeze
def wrong_args
puts 'usage: ruby tinder_fb_token.rb email password'
end
wrong_args if ARGV.count != 2
mechanize = Mechanize.new
mechanize.user_agent = USER_AGENT
login_form = mechanize.get(L).form do |f|
f.email = ARGV[0]
f.pass = ARGV[1]
end
result = login_form.submit.form.submit.body.split('access_token=')[1].split('&')[0]
puts "Facebook Access Token: #{result}"
@gnurio
Copy link

gnurio commented Oct 20, 2016

Thanks! So helpful!

@kyla963
Copy link

kyla963 commented Nov 11, 2016

This looks perfect! However I am having trouble running it.
Very new to coding, so this may be a ridiculous question. But I'm getting error:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- mechanize (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require'
from tinder_fb_token.rb:1:in `

'

How can I fix?

@juliojgarciaperez
Copy link
Author

$ gem install mechanize

:)

@zunnun09
Copy link

Can I get the tinder bot software? I am not a technical guy, but it would be great if someone help me providing the bot software.

@dhruvghulati-zz
Copy link

dhruvghulati-zz commented Jan 1, 2018

Getting tinder_fb_token.rb:26:in '<main>': undefined method 'split' for nil:NilClass (NoMethodError) but no idea why its not working for that split method.

I am on ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17] and Rails 5.1.4.

@wlbhiro
Copy link

wlbhiro commented Apr 12, 2019

Same problem.

@kishdubey
Copy link

same

@chibisuke1219
Copy link

I need help im getting this error:
Traceback (most recent call last):
2: from C:/Users/chibi/tinder_fb_token.rb:1:in <main>' 1: from C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require'
C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- mechanize (LoadError) 8: from C:/Users/chibi/tinder_fb_token.rb:1:in

'
7: from C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in require' 6: from C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in rescue in require'
5: from C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in require' 4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/mechanize-2.7.6/lib/mechanize.rb:6:in <top (required)>'
3: from C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' 2: from C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/net-http-persistent-3.0.1/lib/net/http/persistent.rb:190:in <top (required)>' C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/net-http-persistent-3.0.1/lib/net/http/persistent.rb:205:in class:Persistent': uninitialized constant Process::RLIMIT_NOFILE (NameError)

@Thatchantique
Copy link

Getting tinder_fb_token.rb:26:in '<main>': undefined method 'split' for nil:NilClass (NoMethodError) but no idea why its not working for that split method.

I am on ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17] and Rails 5.1.4.

Same issue !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment