Created
August 17, 2016 08:06
-
-
Save juliojgarciaperez/31ccb391cb1fbcb04dc86a16038fca24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |
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
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)