UNPKG

rsshub

Version:
161 lines (158 loc) 4.95 kB
import { t as rofetch } from "./ofetch-C3ts-Hud.mjs"; import "./types-DNj6Etbg.mjs"; import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs"; //#region lib/routes/joneslanglasalle/index.ts const searchApiUrl = "https://www.jll.com/api/search/template"; const subscriptionKey = "8f6a4de5b0144673acaa89b03aac035e"; const localeMap = { zh: { apiLang: "zh-CN", countries: ["China Mainland"], insightsUrl: "https://www.joneslanglasalle.com.cn/zh-cn/insights", title: "洞察 - 仲量联行JLL" }, en: { apiLang: "en-GB", countries: ["China Mainland"], insightsUrl: "https://www.joneslanglasalle.com.cn/en-cn/insights", title: "Insights - JLL China" }, "zh-hk": { apiLang: "zh-HK", countries: ["Hong Kong"], insightsUrl: "https://www.jll.com/zh-hk/insights", title: "洞察 - 仲量聯行JLL 香港" }, "en-hk": { apiLang: "en-GB", countries: ["Hong Kong"], insightsUrl: "https://www.jll.com/en-hk/insights", title: "Insights - JLL Hong Kong" } }; const handler = async (ctx) => { const { language: lang = "zh" } = ctx.req.param(); const limit = Number(ctx.req.query("limit") ?? "12"); const locale = localeMap[lang] || localeMap.zh; const items = (await rofetch(searchApiUrl, { method: "POST", headers: { "Subscription-Key": subscriptionKey, "Content-Type": "application/json" }, body: { id: "jll_dynamic_list_search_template_v2", params: { size: limit, from: 0, countries: locale.countries, language: locale.apiLang, sort_by_relevance: false, includeGlobalPeople: false, boostCountry: "" } } })).hits.hits.map((hit) => { const source = hit._source; return { title: source.title, description: source.description || source.subTitle, link: source.pageUrl, pubDate: source.datePublished ? parseDate(source.datePublished) : void 0, category: [...source.topics || [], ...source.industries || []], image: source.imageUrl, banner: source.imageUrl, language: source.language }; }); return { title: locale.title, link: locale.insightsUrl, item: items, allowEmpty: true, language: locale.apiLang }; }; const route = { path: "/:language?/:category{.+}?", name: "Trends & Insights", url: "joneslanglasalle.com.cn", maintainers: ["nczitzk", "pseudoyu"], handler, example: "/joneslanglasalle/en/trends-and-insights", parameters: { language: "Language, `zh` for China Mainland Chinese, `en` for China Mainland English, `zh-hk` for Hong Kong Chinese, `en-hk` for Hong Kong English, `zh` by default", category: "Category, `trends-and-insights` by default" }, description: `::: tip If you subscribe to [Trends & Insights (China)](https://www.joneslanglasalle.com.cn/en-cn/insights), use \`en\` as the language. For [Hong Kong Insights](https://www.jll.com/zh-hk/insights), use \`zh-hk\` as the language. ::: | Region | Language | Parameter | | -------------- | -------- | --------- | | China Mainland | 中文 | zh | | China Mainland | English | en | | Hong Kong | 中文 | zh-hk | | Hong Kong | English | en-hk |`, categories: ["new-media"], features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportRadar: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [ { source: ["joneslanglasalle.com.cn/:language/:category"], target: (params) => { const language = params.language; const category = params.category; return language ? `/${language}${category ? `/${category}` : ""}` : ""; } }, { title: "Latest", source: ["joneslanglasalle.com.cn/en-cn/insights"], target: "/en/trends-and-insights" }, { title: "房地产趋势与洞察", source: ["joneslanglasalle.com.cn/zh-cn/insights"], target: "/zh/trends-and-insights" }, { source: ["jll.com/zh-hk/insights"], target: "/zh-hk/trends-and-insights" }, { source: ["jll.com/en-hk/insights"], target: "/en-hk/trends-and-insights" } ], view: 0, zh: { path: "/:language?/:category{.+}?", name: "房地产趋势与洞察", url: "joneslanglasalle.com.cn", maintainers: ["nczitzk", "pseudoyu"], handler, example: "/joneslanglasalle/zh/trends-and-insights", parameters: { language: "语言,`zh` 为中国大陆中文,`en` 为中国大陆英文,`zh-hk` 为香港中文,`en-hk` 为香港英文,默认为 `zh`", category: "分类,默认为 `trends-and-insights`" }, description: `::: tip 若订阅 [中国大陆洞察](https://www.joneslanglasalle.com.cn/zh-cn/insights),语言参数为 \`zh\`。若订阅 [香港洞察](https://www.jll.com/zh-hk/insights),语言参数为 \`zh-hk\`。 ::: | 地区 | 语言 | 参数 | | -------- | ------- | ----- | | 中国大陆 | 中文 | zh | | 中国大陆 | English | en | | 香港 | 中文 | zh-hk | | 香港 | English | en-hk |` } }; //#endregion export { handler, route };