fb_video_url_converter 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +3 -1
- data/Rakefile +1 -1
- data/fb_video_url_converter.gemspec +1 -1
- data/lib/facebook_bot.rb +15 -19
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
data/CHANGELOG.rdoc
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
= Version 0.2.6
|
|
2
|
+
* Fix for undefined each for nil class - when cookiejar is corrupted - will clear corrupted cookiejar - so in next request - will relogin
|
|
1
3
|
= Version 0.2.5
|
|
2
|
-
* Removed errors login. Reraising different errors than FacebookBot::LoginFailed so will log automatically. Inserted all cookie_jar operations into begin-rescue blocks because it sometimes raises
|
|
4
|
+
* Removed errors login. Reraising different errors than FacebookBot::LoginFailed so will log automatically. Inserted all cookie_jar operations into begin-rescue blocks because it sometimes raises 'undefined method expired? 4 nil class'
|
|
3
5
|
= Version 0.2.4
|
|
4
6
|
* Experimental Rails errors loggin
|
|
5
7
|
= Version 0.2.3
|
data/Rakefile
CHANGED
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
|
2
2
|
require 'rake'
|
|
3
3
|
require 'echoe'
|
|
4
4
|
|
|
5
|
-
Echoe.new('fb_video_url_converter', '0.2.
|
|
5
|
+
Echoe.new('fb_video_url_converter', '0.2.6') do |p|
|
|
6
6
|
p.description = "Facebook Video URL Converter is intended as an easy alternative to changing video hosting from Facebook to a different one."
|
|
7
7
|
p.url = "https://github.com/mensfeld/FB-Video-URL-Converter"
|
|
8
8
|
p.author = "Maciej Mensfeld"
|
data/lib/facebook_bot.rb
CHANGED
|
@@ -54,29 +54,25 @@ class FacebookBot
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def login
|
|
57
|
-
page = @agent.get(FB_URL)
|
|
58
|
-
|
|
59
|
-
if (loginf = page.form_id("login_form"))
|
|
60
|
-
loginf.set_fields(:email => self.class.email, :pass => self.class.password)
|
|
61
|
-
page = @agent.submit(loginf, loginf.buttons.first)
|
|
62
|
-
# When we login (successfully) we will be redirected in a not so "gracefull"
|
|
63
|
-
# way - so we need to "skip" redirecting page
|
|
64
|
-
page = @agent.get(FB_URL) if page.root.to_html.include?('<title>Redirecting')
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# Donno why but sometimes cookiejar gets crazy - so better be prepared ;)
|
|
68
57
|
begin
|
|
69
|
-
@agent.
|
|
70
|
-
rescue
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
body = page.root.to_html
|
|
58
|
+
page = @agent.get(FB_URL)
|
|
74
59
|
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
if (loginf = page.form_id("login_form"))
|
|
61
|
+
loginf.set_fields(:email => self.class.email, :pass => self.class.password)
|
|
62
|
+
page = @agent.submit(loginf, loginf.buttons.first)
|
|
63
|
+
# When we login (successfully) we will be redirected in a not so "gracefull"
|
|
64
|
+
# way - so we need to "skip" redirecting page
|
|
65
|
+
page = @agent.get(FB_URL) if page.root.to_html.include?('<title>Redirecting')
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
@agent.cookie_jar.save_as(@cookies)
|
|
69
|
+
|
|
70
|
+
body = page.root.to_html
|
|
77
71
|
@post_form_id = %r{<input type="hidden" .* name="post_form_id" value="([^"]+)}.match(body)[1]
|
|
78
72
|
rescue
|
|
79
|
-
|
|
73
|
+
@agent.cookie_jar.clear!
|
|
74
|
+
@agent.cookie_jar.save_as(@cookies)
|
|
75
|
+
raise self.class::LoginFailed, 'Incorrect login/password or cookie corrupted'
|
|
80
76
|
end
|
|
81
77
|
end
|
|
82
78
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|