Skip to content

Commit 592309c

Browse files
committed
fix: Ensure Video scraping on the same protocol as original request. Fixes gottfrois#69
1 parent 3a993fc commit 592309c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/link_thumbnailer/scrapers/base.rb

+5
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ def modelize(node, text = nil)
6262
model_class.new(node, text)
6363
end
6464

65+
def scheme
66+
# Extract the schema from the url
67+
uri = URI.parse("#{@website.url}")
68+
uri.scheme
69+
end
6570
end
6671
end
6772
end

lib/link_thumbnailer/scrapers/opengraph/video.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def value
2222
private
2323

2424
def model
25-
nodes.map { |n| modelize(n, n.attributes['content'].to_s) }
25+
nodes.map { |n| modelize(n, n.attributes['content'].to_s) if n.attributes['content'].to_s.start_with? scheme }
2626
end
2727

2828
def modelize(node, text = nil)

0 commit comments

Comments
 (0)