Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // copy tweets variable from tweets.js file of your Twitter archive
- var tweets = [];
- // Open this HTML file and execute the following JavaScript code in the web console (F12 or Ctrl+Shift+K shortcut)
- // A textarea will appear so you can copy/paste to save data as a CSV file
- /*
- var out = [];
- var length = tweets.length;
- for (var i = 0; i < length; ++i) {
- var name, id;
- if (tweets[i].tweet.entities.user_mentions.length > 0) {
- name = tweets[i].tweet.entities.user_mentions[0].screen_name;
- id = tweets[i].tweet.entities.user_mentions[0].id_str;
- }
- else {
- name = "";
- id = "";
- }
- out[i] = tweets[i].tweet.created_at + '\t"'
- + tweets[i].tweet.full_text.replace(/"/g, '""') + '"\t"""'
- + tweets[i].tweet.id_str + '"""\t'
- + name + '\t"""' // backup name with user ID to make sure it is the correct account (in case the mention order is not sorted)
- + id + '"""'; // backup first mentionned user ID to track a user who deleted a tweet you retweeted / favorited (even if the user changed his username)
- // CSV with tab separator: quote to allow multiline string; escape quote string delimiter with double quote; display large numbers correctly as string with triple quote
- }
- displayData();
- function displayData()
- {
- var box = document.createElement("textarea");
- box.value = out.join('\n');
- document.body.appendChild(box);
- }
- */
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement