mirror of
https://github.com/imsyy/DailyHotApi.git
synced 2026-01-12 13:14:55 +08:00
🐞 fix: 修复微博热榜 #110
This commit is contained in:
3
src/router.types.d.ts
vendored
3
src/router.types.d.ts
vendored
@@ -82,6 +82,9 @@ export type RouterType = {
|
|||||||
};
|
};
|
||||||
weibo: {
|
weibo: {
|
||||||
mid: string;
|
mid: string;
|
||||||
|
itemid: string;
|
||||||
|
desc: string;
|
||||||
|
scheme: string;
|
||||||
word: string;
|
word: string;
|
||||||
word_scheme: string;
|
word_scheme: string;
|
||||||
note: string;
|
note: string;
|
||||||
|
|||||||
@@ -18,24 +18,35 @@ export const handleRoute = async (_: undefined, noCache: boolean) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getList = async (noCache: boolean) => {
|
const getList = async (noCache: boolean) => {
|
||||||
const url = `https://weibo.com/ajax/side/hotSearch`;
|
const url =
|
||||||
const result = await get({ url, noCache, ttl: 60 });
|
"https://m.weibo.cn/api/container/getIndex?containerid=106003type%3D25%26t%3D3%26disable_hot%3D1%26filter_type%3Drealtimehot&title=%E5%BE%AE%E5%8D%9A%E7%83%AD%E6%90%9C&extparam=filter_type%3Drealtimehot%26mi_cid%3D100103%26pos%3D0_0%26c_type%3D30%26display_time%3D1540538388&luicode=10000011&lfid=231583";
|
||||||
const list = result.data.data.realtime;
|
|
||||||
|
const result = await get({
|
||||||
|
url,
|
||||||
|
noCache,
|
||||||
|
ttl: 60,
|
||||||
|
headers: {
|
||||||
|
Referer: "https://s.weibo.com/top/summary?cate=realtimehot",
|
||||||
|
"MWeibo-Pwa": "1",
|
||||||
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
|
"User-Agent":
|
||||||
|
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const list = result.data.data.cards?.[0]?.card_group;
|
||||||
return {
|
return {
|
||||||
...result,
|
...result,
|
||||||
data: list.map((v: RouterType["weibo"]) => {
|
data: list.map((v: RouterType["weibo"]) => {
|
||||||
const key = v.word_scheme ? v.word_scheme : `#${v.word}`;
|
const key = v.word_scheme ? v.word_scheme : `#${v.desc}`;
|
||||||
return {
|
return {
|
||||||
id: v.mid,
|
id: v.itemid,
|
||||||
title: v.word,
|
title: v.desc,
|
||||||
desc: v.note || key,
|
desc: key,
|
||||||
author: v.flag_desc,
|
// author: v.flag_desc,
|
||||||
timestamp: getTime(v.onboard_time),
|
timestamp: getTime(v.onboard_time),
|
||||||
hot: v.num,
|
// hot: v.num,
|
||||||
url: `https://s.weibo.com/weibo?q=${encodeURIComponent(key)}&t=31&band_rank=1&Refer=top`,
|
url: `https://s.weibo.com/weibo?q=${encodeURIComponent(key)}&t=31&band_rank=1&Refer=top`,
|
||||||
mobileUrl: `https://s.weibo.com/weibo?q=${encodeURIComponent(
|
mobileUrl: v?.scheme,
|
||||||
key,
|
|
||||||
)}&t=31&band_rank=1&Refer=top`,
|
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user