The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Use video_play_count for Instagram social bounties (#3726)
Kiran Ke5b59f534f13
diff --git a/apps/web/lib/api/scrape-creators/get-social-content.ts b/apps/web/lib/api/scrape-creators/get-social-content.tsindex b9ad2ae293..8edff4b90d 100644--- a/apps/web/lib/api/scrape-creators/get-social-content.ts+++ b/apps/web/lib/api/scrape-creators/get-social-content.ts@@ -60,7 +60,7 @@ export async function getSocialContent({}const contentType = PLATFORM_CONTENT_TYPE[platform];- const version = platform === "tiktok" ? "v2" : "v1";+ const version = ["tiktok", "instagram"].includes(platform) ? "v2" : "v1";const { data, error } = await scrapeCreatorsFetch("/:version/:platform/:contentType",@@ -134,7 +134,7 @@ export async function getSocialContent({mediaType = "carousel";} else if (data.__typename === "GraphImage") {mediaType = "image";- } else if (thumbnailUrls === undefined && data.video_view_count > 0) {+ } else if (thumbnailUrls === undefined && data.video_play_count > 0) {mediaType = "video";}@@ -142,7 +142,7 @@ export async function getSocialContent({publishedAt: new Date(data.taken_at_timestamp * 1000),handle: data.owner.username,platformId: null,- views: data.video_view_count,+ views: data.video_play_count,likes: data.edge_media_preview_like.count,title: null,description: data.edge_media_to_caption?.edges?.[0]?.node?.text ?? null,diff --git a/apps/web/lib/api/scrape-creators/schema.ts b/apps/web/lib/api/scrape-creators/schema.tsindex 7e02e05594..6bfe441fd7 100644--- a/apps/web/lib/api/scrape-creators/schema.ts+++ b/apps/web/lib/api/scrape-creators/schema.ts@@ -230,7 +230,7 @@ export const socialContentSchema = z.preprocess(owner: z.object({username: z.string(),}),- video_view_count: z+ video_play_count: z.number().nullish().transform((val) => val ?? 0),