busk-ruby-readability 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/readability.rb +25 -0
- data/ruby-readability.gemspec +1 -1
- data/spec/fixtures/cassettes/pages.yml +1517 -26
- data/spec/readability_spec.rb +16 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/readability.rb
CHANGED
@@ -55,6 +55,7 @@ module Readability
|
|
55
55
|
article = youtube if is_youtube? && remove_unlikely_candidates
|
56
56
|
article = vimeo if is_vimeo? && remove_unlikely_candidates
|
57
57
|
article = ted if is_ted? && remove_unlikely_candidates
|
58
|
+
article = slideshare if is_slideshare? && remove_unlikely_candidates
|
58
59
|
article = apply_custom_rule if has_special_rule?
|
59
60
|
|
60
61
|
if article && remove_unlikely_candidates
|
@@ -93,10 +94,34 @@ module Readability
|
|
93
94
|
(@base_uri.to_s =~ /^(www.)?ted.com\/talks/)
|
94
95
|
end
|
95
96
|
|
97
|
+
def is_slideshare?
|
98
|
+
(@base_uri.to_s =~ /^(www.)?slideshare.net/)
|
99
|
+
end
|
100
|
+
|
96
101
|
def is_special_case?
|
97
102
|
(@base_uri.to_s =~ REGEXES[:videoRe])
|
98
103
|
end
|
99
104
|
|
105
|
+
def slideshare
|
106
|
+
title = @document.css("h1.h-slideshow-title").inner_html
|
107
|
+
movie_value = @document.css("link[name='media_presentation']").first.attributes["href"].value
|
108
|
+
Nokogiri::HTML.fragment <<-HTML
|
109
|
+
<div style=\"width:425px\" id=\"__ss_2606283\">
|
110
|
+
<strong style=\"display:block;margin:12px 0 4px\">
|
111
|
+
<a href=\"#{@request}\" title=\"#{title}\">
|
112
|
+
#{title}
|
113
|
+
</a>
|
114
|
+
</strong>
|
115
|
+
<object id=\"__sse2606283\" width=\"425\" height=\"355\">
|
116
|
+
<param name=\"movie\" value=\"#{movie_value}\" />
|
117
|
+
<param name=\"allowFullScreen\" value=\"true\"/>
|
118
|
+
<param name=\"allowScriptAccess\" value=\"always\"/>
|
119
|
+
<embed name=\"__sse2606283\" src=\"#{movie_value}\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"355\"></embed>
|
120
|
+
</object>
|
121
|
+
</div>
|
122
|
+
HTML
|
123
|
+
end
|
124
|
+
|
100
125
|
def youtube
|
101
126
|
debug("I have a Youtube video page")
|
102
127
|
if @request =~ /\?v=([_\-a-z0-9]+)&?/i
|
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.7"
|
6
6
|
s.name = "busk-ruby-readability"
|
7
7
|
s.summary = "A rewrite of original ruby-readability"
|
8
8
|
|