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

Function GetRawInfo

Surge/JS/Bili_Auto_Regions.js:216–251  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

214}
215
216function GetRawInfo(t) {
217 let res = [];
218 let st = Date.now();
219 return new Promise((resolve) => {
220 if (!t) return resolve(res);
221 $.get({
222 url: `https://www.douban.com/search?cat=1002&q=${encodeURIComponent(t)}`,
223 headers: {
224 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15',
225 'Cookie': JSON.stringify(st)
226 }
227 }, (error, resp, data) => {
228 if (error) {
229 console.log(`Douban rating: \n${t}\nRequest error: ${error}\n`);
230 } else {
231 if (/\u767b\u5f55<\/a>\u540e\u91cd\u8bd5\u3002/.test(data)) $.is403 = true;
232 let s = data.replace(/\n| |&#\d{2}/g, '')
233 .match(/\[(\u7535\u5f71|\u7535\u89c6\u5267)\].+?subject-cast\">.+?<\/span>/g) || [];
234 for (let i = 0; i < s.length; i++) {
235 res.push({
236 name: s[i].split(/\}\)">(.+?)<\/a>/)[1],
237 origin: s[i].split(/\u540d:(.+?)(\/|<)/)[1],
238 pd: s[i].split(/\u539f\u540d.+?\/(.+?)\/\d+<\/span>$/)[1],
239 rating: s[i].split(/">(\d\.\d)</)[1],
240 folk: s[i].split(/(\d+\u4eba\u8bc4\u4ef7)/)[1],
241 id: s[i].split(/sid:(\d+)/)[1],
242 year: s[i].split(/(\d+)<\/span>$/)[1]
243 })
244 }
245 let et = ((Date.now() - st) / 1000).toFixed(2);
246 console.log(`Douban rating: \n${t}\n${res.length} movie info searched. (${et} s)\n`);
247 }
248 resolve(res);
249 })
250 })
251}
252
253function nobyda() {
254 const isHTTP = typeof $httpClient != "undefined";

Callers 1

QueryRatingFunction · 0.85

Calls 3

getMethod · 0.45
stringifyMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected