README.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Top 25 most influential Tweeters of 2022 and prior,
  2. Of 250 users bookmarked in 5,690 Tweets:
  3. 1. ...
  4. This report was built with data from my personal apps.
  5. Stay tuned for my engagement report where I cound my number of Retweets for the same users--
  6. my equivalent to the Like button. Maybe next year the notes app will have date limited searches.
  7. As my capabilities and wisdom evolve my approach to social media will follow.
  8. Thanks.
  9. Code to build this report is included in the upcoming verson of The Notes App.
  10. https://harlanji.gumroad.com/l/the-notes-app
  11. ```
  12. notesAppUrl = 'http://localhost:5000'
  13. temp1 = await fetch(notesAppUrl + '/notes/cards/search?q=twitter.com/').then(r => r.json())
  14. re = /(https?[a-z0-9\.\/\:]+twitter\.com\/[0-9a-z\_]+\/status\/[\d]+)/ig
  15. cardMatches = temp1.cards
  16. .map(cm => Object.assign({}, cm, {tweetLinks: Array.from(new Set(cm.card.content.match(re)))}))
  17. .filter(cm => cm.tweetLinks && cm.tweetLinks.length)
  18. .map(cm => Object.assign({}, cm, {tweetUrls: cm.tweetLinks.map(l => new URL(l))}))
  19. .map(cm => Object.assign({}, cm, {tweetInfos: cm.tweetUrls.map(u => ({user: u.pathname.split('/')[1], tweetId: u.pathname.split('/')[3]}))}));
  20. tweetsByUser = cardMatches.reduce(function (report, m) {
  21. m.tweetInfos.forEach(function (ti) {
  22. if (!(ti.user in report)) {
  23. report[ti.user] = [];
  24. }
  25. report[ti.user].push(ti);
  26. });
  27. return report;
  28. }, {});
  29. tweetsById = cardMatches.reduce(function (report, m) {
  30. m.tweetInfos.forEach(function (ti) {
  31. if (!report[ti.tweetId]) {
  32. report[ti.tweetId] = [];
  33. }
  34. report[ti.tweetId].push(ti);
  35. });
  36. return report;
  37. }, {});
  38. top25Authors = Object.entries(tweetsByUser).sort(function (a, b) { return b[1].length - a[1].length }).slice(0,25)
  39. console.log("Top 25 authors:")
  40. console.log(top25Authors.map((e, i) => `${i+1}.\t@${e[0]}: ${e[1].length}` ).join("\n"))
  41. console.log("Total tweets: " + Object.keys(tweetsById).length);
  42. ```