Merge pull request #125 from yll14/patch-1

修复微博403问题
This commit is contained in:
imsyy
2025-12-06 18:45:28 +08:00
committed by GitHub

View File

@@ -19,43 +19,36 @@ export const handleRoute = async (_: undefined, noCache: boolean) => {
};
const getList = async (noCache: boolean) => {
const url =
"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 url = "https://weibo.com/ajax/side/hotSearch";
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",
Referer: "https://weibo.com/",
"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",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
},
});
const list = result.data.data.cards?.[0]?.card_group;
if (!result.data?.data?.realtime) {
return { ...result, data: [] };
}
const list = result.data.data.realtime;
return {
...result,
data: list
.filter(
(v: RouterType["weibo"]) =>
!(
v?.pic === "https://simg.s.weibo.com/20210408_search_point_orange.png" &&
config.FILTER_WEIBO_ADVERTISEMENT
),
)
.map((v: RouterType["weibo"]) => {
const key = v.word_scheme ?? `#${v.desc}`;
return {
id: v.itemid,
title: v.desc,
desc: key,
timestamp: getTime(v.onboard_time),
hot: v.desc_extr,
url: `https://s.weibo.com/weibo?q=${encodeURIComponent(key)}&t=31&band_rank=1&Refer=top`,
mobileUrl: v?.scheme,
};
}),
data: list.map((v: any, index: number) => {
const title = v.word || v.word_scheme || `热搜${index + 1}`;
return {
id: v.mid || v.word_scheme || `weibo-${index}`,
title: title,
desc: v.word_scheme || `#${title}#`,
timestamp: getTime(v.onboard_time || Date.now()),
url: `https://s.weibo.com/weibo?q=${encodeURIComponent(title)}`,
mobileUrl: `https://s.weibo.com/weibo?q=${encodeURIComponent(title)}`,
};
}),
};
};