diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-25 21:34:11 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-25 21:34:11 -0500 |
| commit | c3d8ca68b332af311bb2d394f6dc0aa80251b607 (patch) | |
| tree | 6ffed18d5fa4757bdd02262df938289dbab243cb | |
| parent | a37692cce477a58913a7ad7b55a731c4251732c7 (diff) | |
| download | invidious-c3d8ca68b332af311bb2d394f6dc0aa80251b607.tar.gz invidious-c3d8ca68b332af311bb2d394f6dc0aa80251b607.tar.bz2 invidious-c3d8ca68b332af311bb2d394f6dc0aa80251b607.zip | |
Add code to calculate video rating
| -rw-r--r-- | src/invidious.cr | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 41c1db9c..b8c62972 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -281,7 +281,9 @@ get "/watch" do |env| rvs << HTTP::Params.parse(rv).to_h end + # rating = (video.likes.to_f/(video.likes.to_f + video.dislikes.to_f) * 4 + 1) rating = video.info["avg_rating"].to_f64 + engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100) playability_status = video.player_response["playabilityStatus"]? |
