MCPcopy Create free account
hub / github.com/NobyDa/Script / get_douban_rating_message

Function get_douban_rating_message

Disney/DisneyRating.js:157–164  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

155}
156
157function get_douban_rating_message(data) {
158 const s = data.replace(/\n| |&#\d{2}/g, '')
159 .match(/\[(\u7535\u5f71|\u7535\u89c6\u5267)\].+?subject-cast\">.+?<\/span>/g);
160 const average = s ? s[0].split(/">(\d\.\d)</)[1] || '' : '';
161 const numRaters = s ? s[0].split(/(\d+)\u4eba\u8bc4\u4ef7/)[1] || '' : '';
162 const rating_message = `Douban: ⭐️ ${average ? average + "/10" : "N/A"} ${!numRaters ? "" : parseFloat(numRaters).toLocaleString()}`;
163 return average && rating_message;
164}
165
166function get_country_message(data) {
167 const country = data;

Callers 1

requestDoubanRatingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected