MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / getNewsList

Function getNewsList

tech-study.js:407–422  ·  view source on GitHub ↗

* @description 获取新闻数据

()

Source from the content-addressed store, hash-verified

405 * @description 获取新闻数据
406 */
407async function getNewsList() {
408 // 随机
409 const randNum = ~~(Math.random() * API_CONFIG.todayNews.length);
410 try {
411 // 获取重要新闻
412 const res = await fetch(API_CONFIG.todayNews[randNum], {
413 method: 'GET',
414 });
415 // 请求成功
416 if (res.ok) {
417 const data = await res.json();
418 return data;
419 }
420 }
421 catch (err) { }
422}
423/**
424 * @description 获取视频数据
425 */

Callers 1

getNewsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected