summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-04-11 11:53:07 -0500
committerOmar Roth <omarroth@hotmail.com>2019-04-11 11:53:07 -0500
commit611555514c31230bcdc1980e0b110cca057b3b72 (patch)
tree04db8ac450e23a258e9408d3e705b9290ef0c975 /src
parente1c78fcbd304d8a1ed7fbe418526718578c94d6d (diff)
downloadinvidious-611555514c31230bcdc1980e0b110cca057b3b72.tar.gz
invidious-611555514c31230bcdc1980e0b110cca057b3b72.tar.bz2
invidious-611555514c31230bcdc1980e0b110cca057b3b72.zip
Remove unnecessary XML declaration
Diffstat (limited to 'src')
-rw-r--r--src/invidious/comments.cr14
-rw-r--r--src/invidious/videos.cr2
2 files changed, 9 insertions, 7 deletions
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index aa3233d4..cd96565b 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -441,8 +441,12 @@ def replace_links(html)
end
end
- html = html.to_xml(options: XML::SaveOptions::NO_DECL)
- return html
+ html = html.xpath_node(%q(//body)).not_nil!
+ if node = html.xpath_node(%q(./p))
+ html = node
+ end
+
+ return html.to_xml(options: XML::SaveOptions::NO_DECL)
end
def fill_links(html, scheme, host)
@@ -459,12 +463,10 @@ def fill_links(html, scheme, host)
end
if host == "www.youtube.com"
- html = html.xpath_node(%q(//body)).not_nil!.to_xml
- else
- html = html.to_xml(options: XML::SaveOptions::NO_DECL)
+ html = html.xpath_node(%q(//body/p)).not_nil!
end
- return html
+ return html.to_xml(options: XML::SaveOptions::NO_DECL)
end
def content_to_comment_html(content)
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index 2f5faf98..beaa1330 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -880,7 +880,7 @@ def fetch_video(id, proxies, region)
info["avg_rating"] = "#{avg_rating}"
description = html.xpath_node(%q(//p[@id="eow-description"]))
- description = description ? description.to_xml : ""
+ description = description ? description.to_xml(options: XML::SaveOptions::NO_DECL) : ""
wilson_score = ci_lower_bound(likes, likes + dislikes)