mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Only replace "/watch" links in Reddit description
This commit is contained in:
parent
66f639a1d1
commit
c42c0b65b0
1 changed files with 1 additions and 12 deletions
|
@ -132,17 +132,6 @@ def fetch_video(id, client)
|
||||||
dislikes = dislikes ? dislikes.content.delete(",").to_i : 0
|
dislikes = dislikes ? dislikes.content.delete(",").to_i : 0
|
||||||
|
|
||||||
description = html.xpath_node(%q(//p[@id="eow-description"]))
|
description = html.xpath_node(%q(//p[@id="eow-description"]))
|
||||||
if description
|
|
||||||
description.xpath_nodes(%q(//a/@href)).each do |match|
|
|
||||||
uri = URI.parse(match.content)
|
|
||||||
|
|
||||||
if uri.host =~ /(www\.)?youtube.com/
|
|
||||||
uri = uri.full_path
|
|
||||||
end
|
|
||||||
|
|
||||||
match.content = uri.to_s
|
|
||||||
end
|
|
||||||
end
|
|
||||||
description = description ? description.to_xml : ""
|
description = description ? description.to_xml : ""
|
||||||
|
|
||||||
wilson_score = ci_lower_bound(likes, likes + dislikes)
|
wilson_score = ci_lower_bound(likes, likes + dislikes)
|
||||||
|
@ -303,7 +292,7 @@ def template_comments(root)
|
||||||
body_html.xpath_nodes(%q(//a/@href)).each do |match|
|
body_html.xpath_nodes(%q(//a/@href)).each do |match|
|
||||||
uri = URI.parse(match.content)
|
uri = URI.parse(match.content)
|
||||||
|
|
||||||
if uri.host =~ /(www\.)?youtube.com/
|
if uri.host =~ /(www\.)?youtube.com/ && uri.path == "/watch"
|
||||||
uri = uri.full_path
|
uri = uri.full_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue