Extract all tweets from Twitter

Get all tweets from a tweeter timeline in one go. A button is provided in the navigation bar. Click the button, get the tweets in the textbox. Copy tweets and save locally.

  1. // ==UserScript==
  2. // @name Extract all tweets from Twitter
  3. // @name:ja Extract all tweets from Twitter
  4. // @namespace https://gf.qytechs.cn/ja/users/100769-atul-k
  5. // @description Get all tweets from a tweeter timeline in one go. A button is provided in the navigation bar. Click the button, get the tweets in the textbox. Copy tweets and save locally.
  6. // @description:ja Get all tweets from a tweeter timeline in one go. A button is provided in the navigation bar. Click the button, get the tweets in the textbox. Copy tweets and save locally.
  7. // @include https://twitter.com/*
  8. // @include https://twitter.com/*
  9. // @author atul k
  10. // @version 0.5.0
  11. // @grant none
  12. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  13. // @license MIT License
  14. // ==/UserScript==
  15. (function () {
  16.  
  17. var createButton = function () {
  18. var button = document.createElement('li');
  19. button.setAttribute('class', 'dm-nav');
  20. button.innerHTML =
  21. ' <a data-original-title="" role="button" href="#" data-placement="bottom"> ' +
  22. ' <span class="Icon Icon--dm Icon--large"></span> ' +
  23. ' <span class="text">Get Tweets</span> ' +
  24. ' <span class="dm-new"><span class="count-inner"></span></span> ' +
  25. '</a>';
  26. button.addEventListener('click', function (event) {
  27. event.stopPropagation();
  28. var allTweets = $.map($('.tweet-text'), function(val) { return [$(val).text()]})
  29. var bigString = ""
  30. allTweets.forEach(function(e, i) {
  31. bigString += e + "\n\n"
  32. })
  33. //window.prompt("Copy to clipboard: Ctrl+C, Enter", bigString);
  34. if (confirm(bigString) == true) {
  35. x = "sdf"
  36. } else {
  37. x = "You pressed Cancel!";
  38. }
  39. //alert(bigString);
  40. });
  41. button.addEventListener('mouseenter',function(){
  42. });
  43. button.addEventListener('mouseleave',function(){
  44. });
  45. return button;
  46. };
  47. var list = document.getElementById('global-actions');
  48. list.appendChild(createButton());
  49. }) ();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址