fb_video_url_converter 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ = Version 0.2.8
2
+ * Fixed totaly invalid URL respond status
3
+ * Fixed responding to short urls
4
+ * Fixed video names gathering
1
5
  = Version 0.2.7
2
6
  * Fixed tests and dependencies
3
7
  = Version 0.2.6
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('fb_video_url_converter', '0.2.7') do |p|
6
+ Echoe.new('fb_video_url_converter', '0.2.8') do |p|
7
7
  p.description = "Facebook Video URL Converter is intended as an easy alternative to changing video hosting from Facebook to a different one."
8
8
  p.url = "https://github.com/mensfeld/FB-Video-URL-Converter"
9
9
  p.author = "Maciej Mensfeld"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fb_video_url_converter}
5
- s.version = "0.2.7"
5
+ s.version = "0.2.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Maciej Mensfeld}]
9
- s.date = %q{2011-07-03}
9
+ s.date = %q{2012-01-15}
10
10
  s.description = %q{Facebook Video URL Converter is intended as an easy alternative to changing video hosting from Facebook to a different one.}
11
11
  s.email = %q{maciej@mensfeld.pl}
12
12
  s.extra_rdoc_files = [%q{CHANGELOG.rdoc}, %q{README.md}, %q{lib/facebook_bot.rb}, %q{lib/facebook_video.rb}, %q{lib/fb_video_url_converter.rb}, %q{lib/generators/fb_video_url_converter/install_generator.rb}, %q{lib/generators/fb_video_url_converter/templates/create_facebook_videos_migration.rb}, %q{lib/generators/fb_video_url_converter/templates/facebook_video_converter_init.rb}]
data/lib/facebook_bot.rb CHANGED
@@ -111,7 +111,7 @@ class FacebookBot
111
111
  end
112
112
 
113
113
  def get_name(site)
114
- name = site.scan(/datawrap\">(.+)<\/h3>/ix).first
114
+ name = site.scan(/title>(.+)<\/title>/ix).first
115
115
  name ? name.first : VIDEO_ERROR
116
116
  end
117
117
 
@@ -84,7 +84,7 @@ class FacebookVideo < ActiveRecord::Base
84
84
  http = Net::HTTP.new(host)
85
85
  headers = http.head(self.url)
86
86
  rescue
87
- return true
87
+ return false
88
88
  end
89
89
  if headers.code == "200"
90
90
  true
@@ -49,7 +49,7 @@ describe FacebookBot do
49
49
 
50
50
  it "should obtain valid name of a valid movie" do
51
51
  fb = subject.new
52
- fb.video_name('111449252268656').should eql 'Naruto Shippuuden #203 Part2 [HD]'
52
+ fb.video_name('111449252268656').should eql 'Naruto Shippuuden #203 Part2'
53
53
  end
54
54
 
55
55
  it "should obtain valid error msg of a invalid movie" do
@@ -20,9 +20,9 @@ describe FacebookVideo do
20
20
  end
21
21
 
22
22
  it "should fetch it and return name" do
23
- FacebookVideo.get('111449252268656').name.should eql 'Naruto Shippuuden #203 Part2 [HD]'
23
+ FacebookVideo.get('111449252268656').name.should eql 'Naruto Shippuuden #203 Part2'
24
24
  url = 'http://www.facebook.com/video/video.php?v=111449252268656&comments'
25
- FacebookVideo.get(url).name.should eql 'Naruto Shippuuden #203 Part2 [HD]'
25
+ FacebookVideo.get(url).name.should eql 'Naruto Shippuuden #203 Part2'
26
26
  end
27
27
  end
28
28
 
@@ -50,6 +50,17 @@ describe FacebookVideo do
50
50
  end
51
51
  end
52
52
 
53
+ context "when video url is corrupted" do
54
+ it "should tell us that video is invalid" do
55
+ t = Time.now
56
+ FacebookVideo.get('111449252268656')
57
+ v = FacebookVideo.find_by_video_id('111449252268656')
58
+ v.url = 'dasdasdasdasd'
59
+ v.cached_at = Time.at(946702800)
60
+ v.valid?.should == false
61
+ end
62
+ end
63
+
53
64
  context "when we obtain invalid video" do
54
65
  it "should return warning" do
55
66
  FacebookVideo.get('').url.should eql :video_id_error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_video_url_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-03 00:00:00.000000000Z
12
+ date: 2012-01-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &20129400 !ruby/object:Gem::Requirement
16
+ requirement: &26614420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *20129400
24
+ version_requirements: *26614420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mechanize
27
- requirement: &20128940 !ruby/object:Gem::Requirement
27
+ requirement: &26613960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *20128940
35
+ version_requirements: *26613960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &20128400 !ruby/object:Gem::Requirement
38
+ requirement: &26613420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 2.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *20128400
46
+ version_requirements: *26613420
47
47
  description: Facebook Video URL Converter is intended as an easy alternative to changing
48
48
  video hosting from Facebook to a different one.
49
49
  email: maciej@mensfeld.pl