Skip to content

Commit 9aa55f5

Browse files
authored
fix(route/patreon): use Patreon API (#20803)
* fix(route/patreon): support creator under /cw/ * fix(route/patreon): improve regex * fix(route/patreon): streamline creator data extraction from Patreon API
1 parent 6b38e2c commit 9aa55f5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/routes/patreon/feed.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,10 @@ async function handler(ctx) {
123123
const ogImage = $('meta[property="og:image"]').attr('content');
124124
const creatorId = decodeURIComponent(ogImage || '').match(/card-teaser-image\/creator\/(\d+?)\?/)?.[1];
125125
if (creatorId) {
126+
const creator = await ofetch(`${baseUrl}/api/campaigns/${creatorId}`);
126127
return {
127128
id: creatorId,
128-
attributes: {
129-
name: $('meta[property="og:title"]').attr('content'),
130-
creation_name: $('meta[name="description"]').attr('content'),
131-
avatar_photo_url: $('link[rel="preload"][as="image"]').attr('href') || ogImage,
132-
},
129+
attributes: creator.data.attributes,
133130
};
134131
}
135132
throw new Error('Unable to extract creator ID');

0 commit comments

Comments
 (0)