diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-07-29 09:48:33 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-07-29 09:48:33 -0500 |
| commit | c07016b45cd0eeb5099fcac48b9d3a1a6cb02943 (patch) | |
| tree | 75e12a4bb326eb14d5c95ea3f79ce6538123ab14 /src | |
| parent | 964a9e2abd7651f1d042e10789e31387be229723 (diff) | |
| download | invidious-c07016b45cd0eeb5099fcac48b9d3a1a6cb02943.tar.gz invidious-c07016b45cd0eeb5099fcac48b9d3a1a6cb02943.tar.bz2 invidious-c07016b45cd0eeb5099fcac48b9d3a1a6cb02943.zip | |
Fix template_comments and comments with formatting
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 5 | ||||
| -rw-r--r-- | src/invidious/helpers.cr | 13 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 7e109407..deebd44e 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -221,7 +221,7 @@ end decrypt_function = [] of {name: String, value: Int32} spawn do loop do - client = make_client(YT_URL) + client = make_client(YT_URL) begin decrypt_function = update_decrypt_function(client) @@ -589,7 +589,8 @@ get "/api/v1/comments/:id" do |env| end content_text = item_comment["contentText"]["simpleText"]?.try &.as_s.rchop('\ufeff') - content_text ||= item_comment["contentText"]["runs"][0]["text"].as_s.rchop('\ufeff') + content_text ||= item_comment["contentText"]["runs"].as_a.map { |comment| comment["text"] } + .join("").rchop('\ufeff') json.field "author", item_comment["authorText"]["simpleText"] json.field "authorThumbnails" do diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr index 370e1efd..9c949bf5 100644 --- a/src/invidious/helpers.cr +++ b/src/invidious/helpers.cr @@ -519,12 +519,13 @@ def template_youtube_comments(comments) if child["replies"]? replies_html = <<-END_HTML <div id="replies" class="pure-g"> - <div class="pure-u-md-1-24"></div> - <div class="pure-u-md-23-24"> - <p> - <a href="javascript:void(0)" data-continuation="#{child["replies"]["continuation"]}" - onclick="load_comments(this)">View #{child["replies"]["replyCount"]} replies</a> - </p> + <div class="pure-u-md-1-24"></div> + <div class="pure-u-md-23-24"> + <p> + <a href="javascript:void(0)" data-continuation="#{child["replies"]["continuation"]}" + onclick="load_comments(this)">View #{child["replies"]["replyCount"]} replies</a> + </p> + </div> </div> END_HTML end |
