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

Function ExtractMovieInfo

Surge/JS/Bili_Auto_Regions.js:191–214  ·  view source on GitHub ↗
(ret, fv)

Source from the content-addressed store, hash-verified

189}
190
191function ExtractMovieInfo(ret, fv) {
192 const sole = new Set(ret.map(s => JSON.stringify(s))); //delete duplicate
193 const f1 = [...sole].map(p => JSON.parse(p))
194 .filter(t => {
195 t.accuracy = 0;
196 if (t.name && fv[0]) { //title
197 if (t.name.includes(fv[0].slice(0, 4))) t.accuracy++;
198 if (t.name.includes(fv[0].slice(-3))) t.accuracy++;
199 }
200 if (t.origin && fv[1]) { //origin title
201 if (t.origin.includes(fv[1].slice(0, 4))) t.accuracy++;
202 if (t.origin.includes(fv[1].slice(-3))) t.accuracy++;
203 }
204 if (t.pd && fv[2]) { //producer or actor
205 const len = t.pd.split('/').filter(c => fv[2].includes(c));
206 t.accuracy += len.length;
207 }
208 if (t.year && fv[3] && t.year == fv[3]) t.accuracy++; //year
209 return Boolean(t.accuracy);
210 });
211 let x = {}; //assign most similar
212 const f2 = f1.reduce((p, c) => c.accuracy > p ? (x = c, c.accuracy) : p, 0);
213 return [x.rating, x.folk, x.name, x.id, f1];
214}
215
216function GetRawInfo(t) {
217 let res = [];

Callers 1

QueryRatingFunction · 0.85

Calls 1

stringifyMethod · 0.45

Tested by

no test coverage detected