diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-15 11:47:37 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-15 11:47:37 -0500 |
| commit | 45ce301bd29c0efda0c8f7c05a36765c5be187ff (patch) | |
| tree | ab13c571775dac8ad6ea0bc734381b1c329649a3 | |
| parent | d9ea8e413e0bb117f18271bbfd38fdb64d114739 (diff) | |
| download | invidious-45ce301bd29c0efda0c8f7c05a36765c5be187ff.tar.gz invidious-45ce301bd29c0efda0c8f7c05a36765c5be187ff.tar.bz2 invidious-45ce301bd29c0efda0c8f7c05a36765c5be187ff.zip | |
Fix reply count extraction
| -rw-r--r-- | src/invidious.cr | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index decd10bb..97424c81 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1785,9 +1785,13 @@ get "/api/v1/comments/:id" do |env| json.field "commentId", node_comment["commentId"] if node_replies && !response["commentRepliesContinuation"]? - reply_count = node_replies["moreText"]["simpleText"].as_s.match(/View all (?<count>\d+) replies/) - .try &.["count"].to_i? + reply_count = node_replies["moreText"]["simpleText"].as_s.delete("View all reply replies,") + if reply_count.empty? + reply_count = 1 + else + reply_count = reply_count.try &.to_i? reply_count ||= 1 + end continuation = node_replies["continuations"].as_a[0]["nextContinuationData"]["continuation"].as_s |
