(imdbId)
| 62 | .finally(() => $done({ body: typeof obj == 'object' ? JSON.stringify(obj) : obj })); |
| 63 | |
| 64 | function 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 | |
| 85 | function requestIMDbRating(title, year, type) { |
| 86 | return new Promise(function (resolve, reject) { |
no test coverage detected