A simple tool which lets you scrape twitter accounts and crosspost them to bluesky accounts! Comes with a CLI and a webapp for managing profiles! Works with images/videos/link embeds/threads.
···14import puppeteer from 'puppeteer-core';
15import * as cheerio from 'cheerio';
16import sharp from 'sharp';
17-import { GoogleGenerativeAI } from '@google/generative-ai';
18-19-// ... existing code ...
20-21-async function generateAltText(buffer: Buffer, mimeType: string, contextText: string): Promise<string | undefined> {
22- const config = getConfig();
23- const apiKey = config.geminiApiKey || 'AIzaSyCByANEpkVGkYG6559CqBRlDVKh24dbxE8';
24-25- if (!apiKey) return undefined;
26-27- try {
28- const genAI = new GoogleGenerativeAI(apiKey);
29- const modelRequested = genAI.getGenerativeModel({ model: 'models/gemini-2.5-flash' });
30-31- const prompt = `Describe this image for alt text. Be concise but descriptive.
32- Context from the tweet text: "${contextText}".
33- Use the context to identify specific people, objects, or context mentioned, but describe what is visually present in the image.`;
3435- const result = await modelRequested.generateContent([
36- prompt,
37- {
38- inlineData: {
39- data: buffer.toString('base64'),
40- mimeType
41- }
42- }
43- ]);
44- const response = await result.response;
45- return response.text();
46- } catch (err) {
47- console.warn(`[GEMINI] ⚠️ Failed to generate alt text: ${(err as Error).message}`);
48- return undefined;
49- }
50-}
51import { getConfig } from './config-manager.js';
5253// ESM __dirname equivalent
···14import puppeteer from 'puppeteer-core';
15import * as cheerio from 'cheerio';
16import sharp from 'sharp';
17+import { generateAltText } from './ai-manager.js';
000000000000000018000000000000000019import { getConfig } from './config-manager.js';
2021// ESM __dirname equivalent