busk-ruby-readability 1.2.8 → 1.2.9
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/Gemfile.lock +1 -1
- data/lib/readability.rb +6 -1
- data/ruby-readability.gemspec +1 -1
- data/spec/readability_spec.rb +13 -2
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/readability.rb
CHANGED
@@ -110,7 +110,12 @@ module Readability
|
|
110
110
|
|
111
111
|
def google_videos
|
112
112
|
uri = URI.parse(@base_uri + @request)
|
113
|
-
|
113
|
+
|
114
|
+
if uri.fragment
|
115
|
+
video_id = CGI::parse(uri.fragment)['docid'].first
|
116
|
+
else
|
117
|
+
video_id = CGI::parse(uri.query)['docid'].first
|
118
|
+
end
|
114
119
|
Nokogiri::HTML.fragment <<-HTML
|
115
120
|
<div>
|
116
121
|
<embed id=VideoPlayback src=http://video.google.com/googleplayer.swf?docid=#{video_id}&hl=en&fs=true style=width:400px;height:326px allowFullScreen=true allowScriptAccess=always type=application/x-shockwave-flash>
|
data/ruby-readability.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.authors = ["Fabio Mont Alegre", "Rodrigo Flores"]
|
3
3
|
s.email = "it-team@busk.com"
|
4
4
|
s.homepage = "http://github.com/busk/ruby-readability"
|
5
|
-
s.version = "1.2.
|
5
|
+
s.version = "1.2.9"
|
6
6
|
s.name = "busk-ruby-readability"
|
7
7
|
s.summary = "A rewrite of original ruby-readability"
|
8
8
|
|
data/spec/readability_spec.rb
CHANGED
@@ -269,8 +269,18 @@ describe Readability do
|
|
269
269
|
end
|
270
270
|
|
271
271
|
describe "Google Videos" do
|
272
|
-
it 'should extract the videos' do
|
273
|
-
url = "http://video.google.com/videoplay?docid=-4176721009838609904&hl=en#"
|
272
|
+
it 'should extract the videos from the anchor parameter' do
|
273
|
+
url = "http://video.google.com/videoplay?docid=-4176721009838609904&hl=en#docid=-3818636184384512295"
|
274
|
+
uri = URI.parse(url)
|
275
|
+
response = Net::HTTP.get_response(uri)
|
276
|
+
@parsed_page = Readability::Document.new(Nokogiri::HTML(response.body), uri.host, uri.request_uri + "#" + uri.fragment)
|
277
|
+
@content = @parsed_page.content
|
278
|
+
|
279
|
+
@content.should == " <div>\n <embed id=\"VideoPlayback\" src=\"http://video.google.com/googleplayer.swf?docid=-3818636184384512295&hl=en&fs=true\" style=\"width:400px;height:326px\" allowfullscreen=\"true\" allowscriptaccess=\"always\" type=\"application/x-shockwave-flash\"></embed>\n</div>"
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'should extract the videos from the anchor parameter' do
|
283
|
+
url = "http://video.google.com/videoplay?docid=-4176721009838609904&hl=en"
|
274
284
|
uri = URI.parse(url)
|
275
285
|
response = Net::HTTP.get_response(uri)
|
276
286
|
@parsed_page = Readability::Document.new(Nokogiri::HTML(response.body), uri.host, uri.request_uri)
|
@@ -278,6 +288,7 @@ describe Readability do
|
|
278
288
|
|
279
289
|
@content.should == " <div>\n <embed id=\"VideoPlayback\" src=\"http://video.google.com/googleplayer.swf?docid=-4176721009838609904&hl=en&fs=true\" style=\"width:400px;height:326px\" allowfullscreen=\"true\" allowscriptaccess=\"always\" type=\"application/x-shockwave-flash\"></embed>\n</div>"
|
280
290
|
end
|
291
|
+
|
281
292
|
end
|
282
293
|
|
283
294
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: busk-ruby-readability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 9
|
10
|
+
version: 1.2.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Fabio Mont Alegre
|