Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on September 8, 2024 at 11:17 PM

New Paste 1 (Text)

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 username = document.querySelector('.username');
  if (username) {
    username = username.textContent.slice(1);
    console.log('Identified username:', username);
  } else {
    console.log('Username not 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/') && tweetAuthor.textContent.slice(1) === username) {
        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(/&nbsp;/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');

  
  formattedText = formattedText.replace(/(\d+\/\d+)\s@/g, '$1\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.');
})();