diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-03-04 07:47:07 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-03-04 07:47:07 -0600 |
| commit | c42c0b65b0c95665d5dbec011dd3d61458af2054 (patch) | |
| tree | ed282a4a3327c68de82170853b8c1a0a99131308 | |
| parent | 66f639a1d143590f66a2f96af3c1c07cf1b8727f (diff) | |
| download | invidious-c42c0b65b0c95665d5dbec011dd3d61458af2054.tar.gz invidious-c42c0b65b0c95665d5dbec011dd3d61458af2054.tar.bz2 invidious-c42c0b65b0c95665d5dbec011dd3d61458af2054.zip | |
Only replace "/watch" links in Reddit description
| -rw-r--r-- | src/helpers.cr | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/helpers.cr b/src/helpers.cr index 44262479..9b79c27e 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -132,17 +132,6 @@ def fetch_video(id, client) dislikes = dislikes ? dislikes.content.delete(",").to_i : 0 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 : "" 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| uri = URI.parse(match.content) - if uri.host =~ /(www\.)?youtube.com/ + if uri.host =~ /(www\.)?youtube.com/ && uri.path == "/watch" uri = uri.full_path end |
