Comments: Move 'fetch_reddit' function to own file + module

This commit is contained in:
Samantaz Fox
2023-05-06 20:02:42 +02:00
parent 1b25737b01
commit 634e913da9
4 changed files with 44 additions and 41 deletions

View File

@@ -345,7 +345,7 @@ module Invidious::Routes::API::V1::Videos
sort_by ||= "confidence"
begin
comments, reddit_thread = fetch_reddit_comments(id, sort_by: sort_by)
comments, reddit_thread = Comments.fetch_reddit(id, sort_by: sort_by)
rescue ex
comments = nil
reddit_thread = nil

View File

@@ -98,7 +98,7 @@ module Invidious::Routes::Watch
comment_html = JSON.parse(Comments.fetch_youtube(id, nil, "html", locale, preferences.thin_mode, region))["contentHtml"]
rescue ex
if preferences.comments[1] == "reddit"
comments, reddit_thread = fetch_reddit_comments(id)
comments, reddit_thread = Comments.fetch_reddit(id)
comment_html = template_reddit_comments(comments, locale)
comment_html = fill_links(comment_html, "https", "www.reddit.com")
@@ -107,7 +107,7 @@ module Invidious::Routes::Watch
end
elsif source == "reddit"
begin
comments, reddit_thread = fetch_reddit_comments(id)
comments, reddit_thread = Comments.fetch_reddit(id)
comment_html = template_reddit_comments(comments, locale)
comment_html = fill_links(comment_html, "https", "www.reddit.com")