(data)
| 125 | } |
| 126 | |
| 127 | function get_IMDb_message(data) { |
| 128 | let rating_message = "IMDb: ⭐️ N/A"; |
| 129 | let tomatoes_message = ""; |
| 130 | let country_message = ""; |
| 131 | let ratings = data.Ratings; |
| 132 | let awards_message = ""; |
| 133 | if (data.Awards && data.Awards != "N/A") { |
| 134 | awards_message = "🏆 " + data.Awards; |
| 135 | } |
| 136 | if (ratings.length > 0) { |
| 137 | const imdb_source = ratings[0]["Source"]; |
| 138 | if (imdb_source == "Internet Movie Database") { |
| 139 | const imdb_votes = data.imdbVotes; |
| 140 | const imdb_rating = ratings[0]["Value"]; |
| 141 | rating_message = "IMDb: ⭐️ " + imdb_rating + " " + imdb_votes; |
| 142 | if (data.Type == "movie") { |
| 143 | if (ratings.length > 1) { |
| 144 | const source = ratings[1]["Source"]; |
| 145 | if (source == "Rotten Tomatoes") { |
| 146 | const tomatoes = ratings[1]["Value"]; |
| 147 | tomatoes_message = "Tomatoes: 🍅 " + tomatoes; |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | country_message = get_country_message(data.Country); |
| 154 | return { rating: rating_message, tomatoes: tomatoes_message, country: country_message, awards: awards_message } |
| 155 | } |
| 156 | |
| 157 | function get_douban_rating_message(data) { |
| 158 | const s = data.replace(/\n| |&#\d{2}/g, '') |
no test coverage detected