1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
javascript:(function() {
console.log('Starting tweet collection process...');
var tweets = Array.from(document.querySelectorAll('.timeline-item'));
console.log('Found', tweets.length, 'tweets on the page.');
if (tweets.length === 0) {
console.log('No tweets found. Exiting...');
return;
}
var userTweets = [];
var tweetTexts = [];
var imageUrls = [];
tweets.forEach(tweet => {
var tweetLink = tweet.querySelector('.tweet-link');
var tweetAuthor = tweet.querySelector('.username');
if (tweetLink && tweetAuthor) {
var tweetLinkHref = new URL(tweetLink.href, window.location.href);
var newUrl = tweetLinkHref.href.replace(tweetLinkHref.hostname, 'twitter.com');
if (newUrl && newUrl.includes('/status/')) {
userTweets.push(newUrl);
}
}
var tweetContent = tweet.querySelector('.tweet-content');
if (tweetContent) {
var tweetText = tweetContent.innerHTML;
tweetText = tweetText.replace(/<a href="([^"]+)">[^<]+<\/a>/g, (match, p1) => `[U][URL]${p1}[/URL][/U]`);
tweetText = tweetText.replace(/<br[^>]*>/g, '\n');
tweetText = tweetText.replace(/<[^>]+>/g, '');
tweetText = tweetText.replace(/ /g, ' ');
console.log('Tweet text:', tweetText);
tweetTexts.push({ text: tweetText, author: tweetAuthor.textContent.slice(1) });
var images = Array.from(tweet.querySelectorAll('.attachment.image img'));
images.forEach(img => {
var src = decodeURIComponent(img.src);
var url = new URL(src, window.location.href);
url.hostname = 'pbs.twimg.com';
url.pathname = url.pathname.replace('/pic/', '/media/').replace('/media/media/', '/media/');
url.search = '';
imageUrls.push(`[img]${url.href}[/img]`);
});
} else {
console.log('Tweet text not found for this tweet');
}
});
console.log('Collected', tweetTexts.length, 'tweet texts.');
console.log('Collected', imageUrls.length, 'image URLs.');
var originalUrl = window.location.href;
var originalUrlObj = new URL(originalUrl);
originalUrlObj.hostname = 'twitter.com';
originalUrl = originalUrlObj.href;
var threadContinuedUrls = userTweets.slice(0);
var formattedText = `\n` + [
originalUrl,
`[SPOILER="thread continued"]\n${threadContinuedUrls.join('\n')}\n[/SPOILER]`,
`[SPOILER="full text"]\n\n${tweetTexts.map((tweet, index) => `${index + 1}/${tweetTexts.length}\n@${tweet.author}\n${tweet.text}\n`).join('\n')}\n\n[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]\n[/SPOILER]`,
`[SPOILER="larger images"]\n${imageUrls.join('\n')}\n[/SPOILER]`
].join('\n');
var textArea = document.createElement('textarea');
textArea.value = formattedText;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
var notificationBox = document.createElement('div');
notificationBox.style.position = 'fixed';
notificationBox.style.bottom = '20px';
notificationBox.style.left = '20px';
notificationBox.style.padding = '10px';
notificationBox.style.backgroundColor = 'white';
notificationBox.style.border = '1px solid black';
notificationBox.innerText = 'Copied: ' + imageUrls.length + ' links and ' + tweetTexts.length + ' tweets';
document.body.appendChild(notificationBox);
setTimeout(function() {
notificationBox.style.opacity = '0';
setTimeout(function() {
document.body.removeChild(notificationBox);
}, 1000);
}, 2000);
console.log('Tweet collection process completed and copied to clipboard.');
})();