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', +};