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.
···442442 const videoUrl = mp4s[0].url;
443443 try {
444444 const { buffer, mimeType } = await downloadMedia(videoUrl);
445445- if (buffer.length > 50 * 1024 * 1024) { // Reduced limit to be safer
446446- throw new Error('Video too large');
445445+ if (buffer.length > 95 * 1024 * 1024) {
446446+ console.warn('Video too large (>95MB). Linking to tweet.');
447447+ const tweetUrl = `https://twitter.com/${twitterUsername}/status/${tweetId}`;
448448+ if (!text.includes(tweetUrl)) text += `\n${tweetUrl}`;
449449+ continue;
447450 }
448451 const blob = await uploadToBluesky(agent, buffer, mimeType);
449452 videoBlob = blob;
450453 videoAspectRatio = aspectRatio;
454454+ break; // Prioritize video and stop looking for other media
451455 } catch (err) {
452456 console.warn(`Failed to upload video ${videoUrl}, linking to tweet instead:`, (err as Error).message);
453453- // Link to the actual tweet so it unfurls with the video correctly
454457 const tweetUrl = `https://twitter.com/${twitterUsername}/status/${tweetId}`;
455455- if (!text.includes(tweetUrl)) {
456456- text += `\n${tweetUrl}`;
457457- }
458458+ if (!text.includes(tweetUrl)) text += `\n${tweetUrl}`;
458459 }
459460 }
460461 }