fix(route/nhk/news): update news source (#20252)
This commit is contained in:
@@ -6,7 +6,7 @@ import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
const baseUrl = 'https://www3.nhk.or.jp';
|
||||
const apiUrl = 'https://nwapi.nhk.jp';
|
||||
const apiUrl = 'https://api.nhkworld.jp';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/news/:lang?',
|
||||
@@ -62,7 +62,7 @@ export const route: Route = {
|
||||
|
||||
async function handler(ctx) {
|
||||
const { lang = 'en' } = ctx.req.param();
|
||||
const { data } = await got(`${apiUrl}/nhkworld/rdnewsweb/v7b/${lang}/outline/list.json`);
|
||||
const { data } = await got(`${apiUrl}/nwapi/rdnewsweb/v7b/${lang}/outline/list.json`);
|
||||
const meta = await got(`${baseUrl}/nhkworld/common/assets/news/config/${lang}.json`);
|
||||
|
||||
let items = data.data.map((item) => ({
|
||||
@@ -76,7 +76,7 @@ async function handler(ctx) {
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
cache.tryGet(item.link, async () => {
|
||||
const { data } = await got(`${apiUrl}/nhkworld/rdnewsweb/v6b/${lang}/detail/${item.id}.json`);
|
||||
const { data } = await got(`${apiUrl}/nwapi/rdnewsweb/v6b/${lang}/detail/${item.id}.json`);
|
||||
item.category = Object.values(data.data.categories);
|
||||
item.description = art(path.join(__dirname, 'templates/news.art'), {
|
||||
img: data.data.thumbnails,
|
||||
|
||||
Reference in New Issue
Block a user