fb_video_url_converter 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.rdoc +2 -0
- data/Rakefile +1 -1
- data/fb_video_url_converter.gemspec +2 -2
- data/lib/facebook_bot.rb +18 -6
- data/lib/facebook_video.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +1 -1
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.rdoc
CHANGED
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.4') 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"
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{fb_video_url_converter}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Maciej Mensfeld"]
|
9
9
|
s.cert_chain = ["/home/mencio/.cert_keys/gem-public_cert.pem"]
|
10
|
-
s.date = %q{2011-06-
|
10
|
+
s.date = %q{2011-06-19}
|
11
11
|
s.description = %q{Facebook Video URL Converter is intended as an easy alternative to changing video hosting from Facebook to a different one.}
|
12
12
|
s.email = %q{maciej@mensfeld.pl}
|
13
13
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md", "lib/facebook_bot.rb", "lib/facebook_video.rb", "lib/fb_video_url_converter.rb", "lib/generators/fb_video_url_converter/install_generator.rb", "lib/generators/fb_video_url_converter/templates/create_facebook_videos_migration.rb", "lib/generators/fb_video_url_converter/templates/facebook_video_converter_init.rb"]
|
data/lib/facebook_bot.rb
CHANGED
@@ -38,9 +38,11 @@ class FacebookBot
|
|
38
38
|
|
39
39
|
begin
|
40
40
|
@@root = File.join(Rails.root, 'tmp')
|
41
|
-
|
41
|
+
@@rails = true
|
42
|
+
rescue Exception => e
|
43
|
+
@@rails = false
|
44
|
+
log e
|
42
45
|
raise CookiePathNotInitialized, 'Specify cookie_path' if self.class.cookie_path.nil?
|
43
|
-
# @@root = File.expand_path(File.dirname(__FILE__))
|
44
46
|
@@root = self.class.cookie_path
|
45
47
|
end
|
46
48
|
|
@@ -48,7 +50,8 @@ class FacebookBot
|
|
48
50
|
|
49
51
|
begin
|
50
52
|
@agent.cookie_jar.load(@cookies)
|
51
|
-
rescue
|
53
|
+
rescue Exception => e
|
54
|
+
log e
|
52
55
|
@agent.cookie_jar.clear!
|
53
56
|
end if (File.file?(@cookies) && File.size(@cookies) > 10)
|
54
57
|
|
@@ -72,15 +75,18 @@ class FacebookBot
|
|
72
75
|
begin
|
73
76
|
# This is a UID given to each Facebook user.
|
74
77
|
@uid = %r{\\"user\\":(\d+),\\"hide\\"}.match(body)[1]
|
75
|
-
rescue
|
78
|
+
rescue Exception => e
|
79
|
+
log e
|
76
80
|
@uid = nil
|
77
81
|
end
|
78
82
|
|
79
83
|
# This is a token we need to submit forms.
|
80
84
|
begin
|
81
85
|
@post_form_id = %r{<input type="hidden" .* name="post_form_id" value="([^"]+)}.match(body)[1]
|
82
|
-
rescue
|
86
|
+
rescue Exception => e
|
87
|
+
log e
|
83
88
|
File.open(@cookies, 'w') {|f| f.write('') }
|
89
|
+
@agent.cookie_jar.clear!
|
84
90
|
raise self.class::LoginFailed, 'Incorrect login or password'
|
85
91
|
end
|
86
92
|
end
|
@@ -89,7 +95,8 @@ class FacebookBot
|
|
89
95
|
begin
|
90
96
|
load_video_page(id)
|
91
97
|
get_url(@video_page)
|
92
|
-
rescue
|
98
|
+
rescue Exception => e
|
99
|
+
log e
|
93
100
|
VIDEO_ERROR
|
94
101
|
end
|
95
102
|
end
|
@@ -101,6 +108,11 @@ class FacebookBot
|
|
101
108
|
|
102
109
|
private
|
103
110
|
|
111
|
+
# We log stuff only when using rails (to lazy to write diff logger not for rails)
|
112
|
+
def log(e)
|
113
|
+
Rails.logger.error "[FB_Video_Url_Converter] #{e}" if @@rails
|
114
|
+
end
|
115
|
+
|
104
116
|
def load_video_page(id)
|
105
117
|
if @video_page.nil?
|
106
118
|
pa = @agent.get("#{FB_URL}video/video.php?v=#{id}")
|
data/lib/facebook_video.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: fb_video_url_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Maciej Mensfeld
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
BH3YFsdk
|
32
32
|
-----END CERTIFICATE-----
|
33
33
|
|
34
|
-
date: 2011-06-
|
34
|
+
date: 2011-06-19 00:00:00 +02:00
|
35
35
|
default_executable:
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
��������L�K��x8�s����ĩ�
|