fix: keep unverified Instagram handles as candidates for collection
Instagram HEAD requests often fail (rate limiting, blocking) causing valid handles to be dropped. Now all discovered handles are kept (verified or not) and Apify attempts collection on all of them. Apify's own scraper validates existence more reliably than HEAD requests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>claude/bold-hawking
parent
087f65eec1
commit
1fb1de8303
|
|
@ -190,10 +190,10 @@ export async function verifyAllHandles(
|
|||
tiktok: null,
|
||||
};
|
||||
|
||||
// Instagram — verify each candidate
|
||||
// Instagram — verify each candidate, keep unverified as fallback
|
||||
for (const handle of candidates.instagram.slice(0, 5)) {
|
||||
tasks.push(
|
||||
verifyInstagram(handle).then(v => { if (v.verified) result.instagram.push(v); })
|
||||
verifyInstagram(handle).then(v => { result.instagram.push(v); })
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ Deno.serve(async (req) => {
|
|||
const analysisData: Record<string, unknown> = {};
|
||||
const tasks: Promise<void>[] = [];
|
||||
|
||||
// ─── 1. Instagram (multi-account) ───
|
||||
const igVerified = (verified.instagram || []).filter((v: Record<string, unknown>) => v.verified && v.handle);
|
||||
if (APIFY_TOKEN && igVerified.length > 0) {
|
||||
// ─── 1. Instagram (multi-account) — try ALL candidates including unverified ───
|
||||
const igCandidates = (verified.instagram || []).filter((v: Record<string, unknown>) => v.handle);
|
||||
if (APIFY_TOKEN && igCandidates.length > 0) {
|
||||
tasks.push((async () => {
|
||||
const accounts: Record<string, unknown>[] = [];
|
||||
for (const ig of igVerified) {
|
||||
for (const ig of igCandidates) {
|
||||
const items = await runApifyActor("apify~instagram-profile-scraper", { usernames: [ig.handle], resultsLimit: 12 }, APIFY_TOKEN);
|
||||
const profile = (items as Record<string, unknown>[])[0];
|
||||
if (profile && !profile.error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue