mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-01-31 07:16:17 +00:00
Smarter tweet fetching
This commit is contained in:
parent
0b96c071fc
commit
d330d845b1
@ -19,9 +19,10 @@ module.exports = exports = async function tweets (pages) {
|
||||
const tweetsPresent = Object.keys(twitterCache);
|
||||
|
||||
for (const page of pages) {
|
||||
if (!page.tweets || !page.tweets.length) continue;
|
||||
const tweetids = [ ...page.tweets ];
|
||||
if (!tweetids.length) continue;
|
||||
|
||||
const missing = difference(page.tweets, tweetsPresent);
|
||||
const missing = difference(uniq(tweetids), tweetsPresent);
|
||||
tweetsNeeded.push(...missing);
|
||||
}
|
||||
|
||||
@ -81,9 +82,10 @@ module.exports = exports = async function tweets (pages) {
|
||||
|
||||
// now loop through pages and substitute the tweet data for the ids
|
||||
for (const page of pages) {
|
||||
if (!page.tweets || !page.tweets.length) continue;
|
||||
const tweetids = [ ...page.tweets ];
|
||||
if (!tweetids.length) continue;
|
||||
|
||||
page.tweets = page.tweets.reduce((dict, tweetid) => {
|
||||
page.tweets = tweetids.reduce((dict, tweetid) => {
|
||||
attachTweet(dict, tweetid);
|
||||
return dict;
|
||||
}, {});
|
||||
|
Loading…
x
Reference in New Issue
Block a user