info.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. parseCodecs = (format) => {
  2. const mimeType = format['mimeType']
  3. if (!mimeType) {
  4. return {};
  5. }
  6. const regex = /(?<mimetype>[^/]+\/[^;]+)(?:;\s*codecs="?(?<codecs>[^"]+))?/;
  7. const match = mimeType.match(regex);
  8. if (!match) {
  9. return {};
  10. }
  11. const codecs = match.groups.codecs;
  12. if (!codecs) {
  13. return {};
  14. }
  15. const splitCodecs = codecs.trim().replace(/,$/, '').split(',').map(str => str.trim()).filter(Boolean);
  16. let vcodec = null;
  17. let acodec = null;
  18. for (const fullCodec of splitCodecs) {
  19. const codec = fullCodec.split('.')[0];
  20. if (['avc1', 'avc2', 'avc3', 'avc4', 'vp9', 'vp8', 'hev1', 'hev2', 'h263', 'h264', 'mp4v', 'hvc1', 'av01', 'theora'].includes(codec)) {
  21. if (!vcodec) {
  22. vcodec = fullCodec;
  23. }
  24. } else if (['mp4a', 'opus', 'vorbis', 'mp3', 'aac', 'ac-3', 'ec-3', 'eac3', 'dtsc', 'dtse', 'dtsh', 'dtsl'].includes(codec)) {
  25. if (!acodec) {
  26. acodec = fullCodec;
  27. }
  28. } else {
  29. console.log(`WARNING: Unknown codec ${fullCodec}`);
  30. }
  31. }
  32. if (!vcodec && !acodec) {
  33. if (splitCodecs.length === 2) {
  34. return {
  35. vcodec: splitCodecs[0],
  36. acodec: splitCodecs[1]
  37. };
  38. }
  39. } else {
  40. return {
  41. vcodec: vcodec,
  42. acodec: acodec
  43. };
  44. }
  45. return {};
  46. }
  47. parseSetCookie = (headers) => {
  48. if (!headers) {
  49. return ""
  50. }
  51. const setCookie = headers['Set-Cookie']
  52. if (!setCookie) {
  53. return ""
  54. }
  55. console.log(`setCookie: ${setCookie}`)
  56. let result = 'PREF=hl=en&tz=UTC; SOCS=CAI; GPS=1; ';
  57. const needCookieNames = ['YSC', 'VISITOR_INFO1_LIVE', 'VISITOR_PRIVACY_METADATA'];
  58. for (const i in needCookieNames) {
  59. const cookieName = needCookieNames[i];
  60. const regexp = new RegExp(`${cookieName}=([^;,]+)`)
  61. const match = setCookie.match(regexp)
  62. if (match && match.length === 2) {
  63. const cookieValue = match[1]
  64. if (i != needCookieNames.length - 1) {
  65. result += `${cookieName}=${cookieValue}; `
  66. } else {
  67. result += `${cookieName}=${cookieValue}`
  68. }
  69. }
  70. }
  71. console.log(`current cookie: ${result}`)
  72. return result;
  73. }
  74. request = async (method, url, data = null, headers = {}, platform) => {
  75. if (platform === "WEB") {
  76. url = url.replace("https://www.youtube.com", "http://127.0.0.1");
  77. }
  78. console.log(`request url:${url}`)
  79. console.log(`request data:${data}`)
  80. console.log(`request method:${method}`)
  81. console.log(`request headers:${JSON.stringify((headers))}`)
  82. if (platform === "WEB") {
  83. const res = await fetch(url, {
  84. 'mode': 'cors',
  85. 'method': method,
  86. 'headers': headers,
  87. 'body': data
  88. })
  89. const resData = await res.text()
  90. return Promise.resolve({
  91. 'data': resData,
  92. 'headers': res.headers
  93. });
  94. }
  95. return new Promise((resolve, reject) => {
  96. AF.request(url, method, data, headers, (data, headers, err) => {
  97. if (err) {
  98. reject(err);
  99. } else {
  100. console.log(`response headers: ${headers}`);
  101. resolve({
  102. 'data': data,
  103. 'headers': JSON.parse(headers)
  104. });
  105. }
  106. });
  107. })
  108. }
  109. getStringBetween = (string, needleStart, needleEnd, offsetStart = 0, offsetEnd = 0) => {
  110. const x = string.indexOf(needleStart);
  111. const y = needleEnd ? string.indexOf(needleEnd, x) : string.length;
  112. return string.substring(x + needleStart.length + offsetEnd, y + offsetStart);
  113. }
  114. getDecipherFunction = (jsCode) => {
  115. const match = jsCode.match(/([a-zA-Z0-9]+)=function\([a-zA-Z0-9]+\)\{a=a\.split\(""\).*};/)
  116. if (!match && match.length <= 1) {
  117. return null;
  118. }
  119. let result = "";
  120. const dependencyMatches = match[0].match(/([$a-zA-Z0-9]+\.[$a-zA-Z0-9]+)/g)
  121. const existDependencies = [];
  122. if (dependencyMatches && dependencyMatches.length >= 1) {
  123. for (let currentMatch of dependencyMatches) {
  124. const varName = currentMatch.split('.')[0];
  125. if (existDependencies.includes(varName)) {
  126. continue
  127. }
  128. const varNameMatch = jsCode.match(new RegExp(`var \\${varName}={(.|\\n)*?};`), 'ig');
  129. if (varNameMatch && varNameMatch.length >= 1) {
  130. result += varNameMatch[0] + "\n";
  131. }
  132. existDependencies.push(varName);
  133. }
  134. }
  135. result += `\n${match[0]}`;
  136. console.log(`decipherFunction result: ` + result);
  137. return eval(result);
  138. };
  139. const cache = {};
  140. extractJSSignatureFunction = async (baseJsUrl, platform) => {
  141. const cacheKey = `js:${baseJsUrl}`;
  142. if (cache[cacheKey]) {
  143. console.log(`from cache JSSignatureFunction: ${baseJsUrl}`);
  144. return cache[cacheKey];
  145. }
  146. console.log(`extract baseUrl: ${baseJsUrl}`);
  147. const baseContentResp = await request('GET', baseJsUrl, null, {
  148. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36',
  149. }, platform);
  150. const {data, headers} = baseContentResp;
  151. const decipher = getDecipherFunction(data);
  152. if (decipher) {
  153. cache[cacheKey] = decipher;
  154. }
  155. return decipher;
  156. }
  157. getUrlFromSignature = async (signatureCipher, baseJsUrl, platform) => {
  158. const decipher = await extractJSSignatureFunction(baseJsUrl, platform);
  159. const searchParams = {}
  160. for (const item of signatureCipher.split('&')) {
  161. const [key, value] = item.split('=');
  162. searchParams[decodeURIComponent(key)] = decodeURIComponent(value);
  163. }
  164. const [url, signature, sp] = [searchParams['url'], searchParams['s'], searchParams['sp']];
  165. console.log(`signatureCipher=${signatureCipher}, url=${url}, signature=${signature}, sp=${sp}`)
  166. return `${url}&${sp}=${decipher(signature)}`;
  167. }
  168. detail = async (url, platform) => {
  169. try {
  170. const htmlResp = await request('GET', `${url}&bpctr=9999999999&has_verified=1`, null, {
  171. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36',
  172. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  173. 'Accept-Language': 'en-us,en;q=0.5',
  174. 'Sec-Fetch-Mode': 'navigate',
  175. 'Accept-Encoding': 'gzip, deflate, br',
  176. 'Cookie': 'PREF=hl=en&tz=UTC; SOCS=CAI'
  177. }, platform);
  178. let {data: html, headers: htmlHeaders} = htmlResp;
  179. let regex = /var ytInitialPlayerResponse\s*=\s*({.*?});/;
  180. let match = html.match(regex);
  181. if (!match || !match.length) {
  182. console.log('can not found JSON: ytInitialPlayerResponse');
  183. throw new Error('JSON not found: ytInitialPlayerResponse');
  184. }
  185. const ytInitialPlayerResponse = JSON.parse(match[1]);
  186. const originVideoDetails = ytInitialPlayerResponse['videoDetails'];
  187. console.log(`videoDetails: ${JSON.stringify(originVideoDetails)}`);
  188. const thumbnails = []
  189. for (const item of originVideoDetails['thumbnail']['thumbnails']) {
  190. thumbnails.push({
  191. 'url': item['url'],
  192. 'width': item['width'] + "",
  193. 'height': item['height'] + ""
  194. })
  195. }
  196. let originFormats = [];
  197. const currentFormats = [];
  198. for (const format of ytInitialPlayerResponse["streamingData"]["formats"].concat(ytInitialPlayerResponse["streamingData"]["adaptiveFormats"])) {
  199. if (format) {
  200. format["from"] = "web"
  201. currentFormats.push(format);
  202. }
  203. }
  204. originFormats = originFormats.concat(currentFormats);
  205. console.log(`after html, format size:${originFormats.length}`);
  206. // android
  207. try {
  208. const apiKey = 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w'
  209. const apiUrl = `https://www.youtube.com/youtubei/v1/player?key=${apiKey}&prettyPrint=false`;
  210. const apiResp = await request('POST', apiUrl, JSON.stringify({
  211. "context": {
  212. "client": {
  213. "clientName": "ANDROID",
  214. "clientVersion": "19.09.37",
  215. "androidSdkVersion": 30,
  216. 'userAgent': 'com.google.android.youtube/19.09.37 (Linux; U; Android 11) gzip',
  217. "hl": "en",
  218. "timeZone": "UTC",
  219. "utcOffsetMinutes": 0
  220. }
  221. },
  222. 'videoId': url.replace('https://www.youtube.com/watch?v=', ''),
  223. "params": "CgIIAQ==",
  224. "playbackContext": {
  225. "contentPlaybackContext": {
  226. "html5Preference": "HTML5_PREF_WANTS"
  227. }
  228. },
  229. "contentCheckOk": true,
  230. "racyCheckOk": true
  231. }), {
  232. 'Host': 'www.youtube.com',
  233. 'Connection': 'keep-alive',
  234. 'User-Agent': 'com.google.android.youtube/19.09.37 (Linux; U; Android 11) gzip',
  235. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  236. 'Accept-Language': 'en-us,en;q=0.5',
  237. 'Sec-Fetch-Mode': 'navigate',
  238. 'X-YouTube-Client-Name': '3',
  239. 'X-YouTube-Client-Version': '19.09.37',
  240. 'Origin': 'https://www.youtube.com',
  241. 'Accept-Encoding': 'gzip, deflate, br',
  242. 'Cookie': parseSetCookie(htmlHeaders),
  243. 'Content-Type': 'application/json'
  244. }, platform);
  245. let {data: apiData, _} = apiResp;
  246. console.log(`android api result: ${JSON.stringify(apiResp)}`);
  247. const res = JSON.parse(apiData);
  248. const currentFormats = [];
  249. for (const format of [].concat(res["streamingData"]["formats"]).concat(res["streamingData"]["adaptiveFormats"])) {
  250. if (format) {
  251. format["from"] = "android"
  252. currentFormats.push(format);
  253. }
  254. }
  255. originFormats = originFormats.concat(currentFormats);
  256. } catch (e) {
  257. console.log(`can not found format android api error: ${e}`);
  258. }
  259. console.log(`after android api, format size:${originFormats.length}`);
  260. // ios
  261. try {
  262. const apiKey = 'AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc'
  263. const apiUrl = `https://www.youtube.com/youtubei/v1/player?key=${apiKey}&prettyPrint=false`;
  264. let apiResp = await request('POST', apiUrl, JSON.stringify({
  265. "context": {
  266. "client": {
  267. 'clientName': 'IOS',
  268. 'clientVersion': '19.09.3',
  269. 'deviceModel': 'iPhone14,3',
  270. 'userAgent': 'com.google.ios.youtube/19.09.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)',
  271. "hl": "en",
  272. "timeZone": "UTC",
  273. "utcOffsetMinutes": 0
  274. }
  275. },
  276. 'videoId': url.replace('https://www.youtube.com/watch?v=', ''),
  277. "playbackContext": {
  278. "contentPlaybackContext": {
  279. "html5Preference": "HTML5_PREF_WANTS"
  280. }
  281. },
  282. "contentCheckOk": true,
  283. "racyCheckOk": true
  284. }), {
  285. 'Host': 'www.youtube.com',
  286. 'Connection': 'keep-alive',
  287. 'User-Agent': 'com.google.ios.youtube/19.09.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)',
  288. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  289. 'Accept-Language': 'en-us,en;q=0.5',
  290. 'Sec-Fetch-Mode': 'navigate',
  291. 'X-YouTube-Client-Name': '5',
  292. 'X-YouTube-Client-Version': '19.09.3',
  293. 'Origin': 'https://www.youtube.com',
  294. 'Accept-Encoding': 'gzip, deflate, br',
  295. 'Cookie': parseSetCookie(htmlHeaders),
  296. 'Content-Type': 'application/json'
  297. }, platform);
  298. let {data: apiData, _} = apiResp;
  299. console.log(`ios api result: ${JSON.stringify(apiResp)}`);
  300. const res = JSON.parse(apiData);
  301. const currentFormats = [];
  302. for (const format of [].concat(res["streamingData"]["formats"]).concat(res["streamingData"]["adaptiveFormats"])) {
  303. if (format) {
  304. format["from"] = "ios"
  305. currentFormats.push(format);
  306. }
  307. }
  308. originFormats = originFormats.concat(currentFormats);
  309. } catch (e) {
  310. console.log(`can not found format ios api error: ${e}`);
  311. }
  312. console.log(`after ios api, format size:${originFormats.length}`);
  313. const baseJsUrl = `https://www.youtube.com${JSON.parse(html.match(/set\(({.+?})\);/)[1])["PLAYER_JS_URL"]}`
  314. let formatIds = [];
  315. const formats = [];
  316. for (let format of originFormats) {
  317. console.log(`current format: ${JSON.stringify(format)}`);
  318. if (format && formatIds.indexOf(format['itag']) === -1) {
  319. if (!format["url"]) {
  320. format["url"] = await getUrlFromSignature(format["signatureCipher"], baseJsUrl, platform);
  321. }
  322. if (format["url"]) {
  323. const {vcodec, acodec} = parseCodecs(format)
  324. if (vcodec && acodec) {
  325. formats.push({
  326. "width": format["width"] + "",
  327. "height": format["height"] + "",
  328. "type": format["mimeType"],
  329. "quality": format["quality"],
  330. "itag": format["itag"],
  331. "fps": format["fps"] + "",
  332. "bitrate": format["bitrate"] + "",
  333. "url": format["url"],
  334. "ext": "mp4",
  335. "vcodec": vcodec,
  336. "acodec": acodec,
  337. "vbr": "0",
  338. "abr": "0",
  339. "container": "mp4_dash",
  340. "from": format["from"]
  341. })
  342. formatIds.push(format["itag"]);
  343. }
  344. }
  345. }
  346. }
  347. const ytInitialDataMatch = html.match(/var ytInitialData\s*=\s*({.*?});/);
  348. const recommendInfo = [];
  349. if (ytInitialDataMatch && ytInitialDataMatch.length === 2) {
  350. const ytInitialData = JSON.parse(ytInitialDataMatch[1]);
  351. console.log(`ytInitialData: ${JSON.stringify(ytInitialData)}`);
  352. for (const item of ytInitialData["contents"]?.["twoColumnWatchNextResults"]?.["secondaryResults"]?.["secondaryResults"]?.["results"] || []) {
  353. if (item["compactVideoRenderer"]) {
  354. const recommendVideo = item["compactVideoRenderer"];
  355. console.log(`recommend video: ${JSON.stringify(recommendVideo)}`);
  356. if (recommendVideo["videoId"]) {
  357. recommendInfo.push({
  358. "type": "gridVideoRenderer",
  359. "videoId": recommendVideo["videoId"],
  360. "title": recommendVideo["title"]?.["simpleText"],
  361. "thumbnails": recommendVideo["thumbnail"]?.["thumbnails"],
  362. "channelName": recommendVideo["longBylineText"]?.["runs"]?.[0]?.["text"],
  363. "publishedTimeText": recommendVideo["publishedTimeText"]?.["simpleText"],
  364. "viewCountText": recommendVideo["viewCountText"]?.["simpleText"],
  365. "shortViewCountText": recommendVideo["shortViewCountText"]?.["simpleText"],
  366. "lengthText": recommendVideo["lengthText"]?.["simpleText"]
  367. })
  368. }
  369. }
  370. }
  371. }
  372. const videoDetails = {
  373. "isLiveContent": originVideoDetails["isLiveContent"],
  374. "title": originVideoDetails["title"],
  375. "thumbnails": thumbnails,
  376. "description": originVideoDetails["shortDescription"],
  377. "lengthSeconds": originVideoDetails["lengthSeconds"],
  378. "viewCount": originVideoDetails["viewCount"],
  379. "keywords": originVideoDetails["keywords"],
  380. "author": originVideoDetails["author"],
  381. "channelID": originVideoDetails["channelId"],
  382. "recommendInfo": recommendInfo,
  383. "channelURL": `https://www.youtube.com/channel/${originVideoDetails["channelId"]}`,
  384. "videoId": originVideoDetails["videoId"]
  385. }
  386. const ret = {
  387. "code": 200,
  388. "msg": "",
  389. "data": {
  390. "videoDetails": videoDetails,
  391. "streamingData": {
  392. "formats": formats.reverse()
  393. }
  394. },
  395. "id": "MusicDetailViewModel_detail_url"
  396. }
  397. console.log(`detail result: ${JSON.stringify(ret)}`);
  398. return ret;
  399. } catch (e) {
  400. const ret = {
  401. "code": -1,
  402. "msg": e.toString()
  403. }
  404. console.log(`detail result error: ${JSON.stringify(ret)}`);
  405. console.log(e);
  406. return ret;
  407. }
  408. }
  409. search = async (keyword, next, platform) => {
  410. try {
  411. console.log(`search keyword: ${keyword}`);
  412. console.log(`search next: ${next}`);
  413. if (next) {
  414. const nextObject = JSON.parse(next);
  415. const key = nextObject["key"];
  416. const body = {
  417. context: {
  418. client: {
  419. clientName: "WEB",
  420. clientVersion: "2.20240506.01.00",
  421. },
  422. },
  423. continuation: nextObject["continuation"]
  424. };
  425. let res = await request('POST', `https://www.youtube.com/youtubei/v1/search?key=${key}`, JSON.stringify(body), {}, platform);
  426. const {data, _} = res;
  427. res = JSON.parse(data);
  428. const videos = [];
  429. for (const item of res["onResponseReceivedCommands"][0]["appendContinuationItemsAction"]["continuationItems"][0]["itemSectionRenderer"]["contents"]) {
  430. const video = item["videoRenderer"];
  431. console.log(`search result video: ${JSON.stringify(video)}`);
  432. if (video && video["videoId"]) {
  433. videos.push({
  434. "type": "videoWithContextRenderer",
  435. "data": {
  436. "videoId": video["videoId"],
  437. "title": video["title"]?.["runs"]?.[0]?.["text"],
  438. "thumbnails": video["thumbnail"]?.["thumbnails"],
  439. "channelName": video["longBylineText"]?.["runs"]?.[0]?.["text"],
  440. "publishedTimeText": video["publishedTimeText"]?.["simpleText"],
  441. "viewCountText": video["viewCountText"]?.["simpleText"],
  442. "shortViewCountText": video["shortViewCountText"]?.["simpleText"],
  443. "lengthText": video["lengthText"]?.["simpleText"]
  444. }
  445. });
  446. }
  447. }
  448. const ret = {
  449. "code": 200,
  450. "msg": "",
  451. "data": {
  452. "data": videos,
  453. "next": JSON.stringify({
  454. "key": nextObject["key"],
  455. "continuation": res["onResponseReceivedCommands"]?.[0]?.["appendContinuationItemsAction"]?.["continuationItems"]?.[1]?.["continuationItemRenderer"]?.["continuationEndpoint"]?.["continuationCommand"]?.["token"],
  456. }),
  457. },
  458. "id": "MusicSearchResultViewModel_search_result"
  459. }
  460. console.log(`[next] search result: ${JSON.stringify(ret)}`);
  461. return ret;
  462. } else {
  463. let url = `https://www.youtube.com/results?q=${encodeURIComponent(keyword)}&sp=EgIQAQ%253D%253D`;
  464. const htmlRes = await request('GET', url, null, {}, platform);
  465. const {data: html, _} = htmlRes;
  466. let regex = /var ytInitialData\s*=\s*({.*?});/;
  467. let match = html.match(regex);
  468. if (!match || !match.length) {
  469. console.log("can not found ytInitialData");
  470. throw new Error('JSON not found: ytInitialData');
  471. }
  472. const ytInitialDataResp = JSON.parse(match[1]);
  473. const videos = [];
  474. for (const item of ytInitialDataResp["contents"]?.["twoColumnSearchResultsRenderer"]?.["primaryContents"]?.["sectionListRenderer"]?.["contents"]?.[0]?.["itemSectionRenderer"]?.["contents"]) {
  475. if (item["videoRenderer"]) {
  476. const video = item["videoRenderer"];
  477. console.log(`search result video: ${JSON.stringify(video)}`);
  478. if (video && video["videoId"]) {
  479. videos.push({
  480. "type": "videoWithContextRenderer",
  481. "data": {
  482. "videoId": video["videoId"],
  483. "title": video["title"]?.["runs"]?.[0]?.["text"],
  484. "thumbnails": video["thumbnail"]?.["thumbnails"],
  485. "channelName": video["longBylineText"]?.["runs"]?.[0]?.["text"],
  486. "publishedTimeText": video["publishedTimeText"]?.["simpleText"],
  487. "viewCountText": video["viewCountText"]?.["simpleText"],
  488. "shortViewCountText": video["shortViewCountText"]?.["simpleText"],
  489. "lengthText": video["lengthText"]?.["simpleText"]
  490. }
  491. });
  492. }
  493. }
  494. }
  495. let next = {};
  496. if (html.split("innertubeApiKey").length > 0) {
  497. next["key"] = html
  498. .split("innertubeApiKey")[1]
  499. .trim()
  500. .split(",")[0]
  501. .split('"')[2];
  502. }
  503. next["continuation"] = ytInitialDataResp["contents"]?.["twoColumnSearchResultsRenderer"]?.["primaryContents"]?.["sectionListRenderer"]?.["contents"]?.[1]?.["continuationItemRenderer"]?.["continuationEndpoint"]?.["continuationCommand"]?.["token"]
  504. const ret = {
  505. "code": 200,
  506. "msg": "",
  507. "data": {
  508. "data": videos,
  509. "next": JSON.stringify(next),
  510. },
  511. "id": "MusicSearchResultViewModel_search_result"
  512. }
  513. console.log(`unnext search result: ${JSON.stringify(ret)}`);
  514. return ret;
  515. }
  516. } catch (e) {
  517. const ret = {
  518. "code": -1,
  519. "msg": e.toString()
  520. }
  521. console.log(`search result error: ${JSON.stringify(ret)}`);
  522. return ret;
  523. }
  524. }