INNER CODE UNIT · TypeScript

attemptNitter

steipete/summarize · packages/core/src/content/link-preview/content/index.ts:440

  const attemptNitter = async (): Promise<string | null> => {
    if (nitterUrls.length === 0) {
      return null;
    }
    for (const nitterUrl of nitterUrls) {
      deps.onProgress?.({ kind: "nitter-start", url: nitterUrl });
      try {
        const nitterResult = await fetchHtmlDocument(deps.fetch, nitterUrl, { timeoutMs });
        const nitterHtml = nitterResult.html;
        if (!nitterHtml.trim()) {
          nitterError = new Error(`Nitter returned empty body from ${new URL(nitterUrl).host}`);
          deps.onProgress?.({ kind: "nitter-done", url: nitterUrl, ok: false, textBytes: null });
          continue;
        }
        if (isAnubisHtml(nitterHtml)) {
          nitterError = new Error(
            `Nitter returned Anubis challenge from ${new URL(nitterUrl).host}`,
          );

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…