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

Function requestDoubanRating

Disney/DisneyRating.js:64–83  ·  view source on GitHub ↗
(imdbId)

Source from the content-addressed store, hash-verified

62 .finally(() => $done({ body: typeof obj == 'object' ? JSON.stringify(obj) : obj }));
63
64function requestDoubanRating(imdbId) {
65 return new Promise(function (resolve, reject) {
66 const url = `https://www.douban.com/search?cat=1002&q=${imdbId}`;
67 if (consoleLog) console.log("Disney Douban Rating URL:\n" + url);
68 $tool.get(url, function (error, response, data) {
69 if (!error) {
70 if (consoleLog) console.log("Disney Douban Rating Data:\n" + data);
71 if (response.status == 200) {
72 const rating = get_douban_rating_message(data);
73 resolve({ rating });
74 } else {
75 resolve({});
76 }
77 } else {
78 console.log("Disney Douban Rating Error: " + error);
79 resolve({});
80 }
81 });
82 });
83}
84
85function requestIMDbRating(title, year, type) {
86 return new Promise(function (resolve, reject) {

Callers 1

requestRatingsFunction · 0.85

Calls 3

logMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected