From c9f4e69460aad2c03b37475b54a3be5791c3558a Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Tue, 4 Mar 2025 06:34:57 -0800 Subject: [PATCH] feat(route): add likeshop route (#18387) (#18508) --- lib/routes/likeshop/index.ts | 43 ++++++++++++++++++++++++++++++++ lib/routes/likeshop/namespace.ts | 7 ++++++ 2 files changed, 50 insertions(+) create mode 100644 lib/routes/likeshop/index.ts create mode 100644 lib/routes/likeshop/namespace.ts diff --git a/lib/routes/likeshop/index.ts b/lib/routes/likeshop/index.ts new file mode 100644 index 000000000..71e13756b --- /dev/null +++ b/lib/routes/likeshop/index.ts @@ -0,0 +1,43 @@ +import { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +export const route: Route = { + path: '/:site', + categories: ['social-media'], + example: '/likeshop/bloombergpursuits', + parameters: { site: 'the site attached to likeshop.me/' }, + radar: [ + { + source: ['likeshop.me/'], + }, + ], + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + name: 'Posts', + maintainers: ['nickyfoto'], + handler, + description: 'LikeShop link in bio takes your audience from Instagram and TikTok to your website in one easy step.', +}; + +async function handler(ctx) { + const site = ctx.req.param('site'); + const link = `https://api.likeshop.me/api/accounts/${site}/galleries/likeshop`; + const data = await ofetch(link); + const items = data.data.media.map((item) => ({ + title: item.comment, + link: item.product_url.split('?')[0], + description: `

`, + guid: item.id, + })); + return { + title: `@${site} Likeshop`, + link: `https://likeshop.me/${site}`, + item: items, + }; +} diff --git a/lib/routes/likeshop/namespace.ts b/lib/routes/likeshop/namespace.ts new file mode 100644 index 000000000..3826d70fb --- /dev/null +++ b/lib/routes/likeshop/namespace.ts @@ -0,0 +1,7 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: 'LikeShop', + url: 'likeshop.me', + lang: 'en', +};