Skip to content

Instantly share code, notes, and snippets.

@brunohubner
Created January 5, 2025 21:35
Show Gist options
  • Select an option

  • Save brunohubner/5a061b812b1bef75677d492ece5cbf4a to your computer and use it in GitHub Desktop.

Select an option

Save brunohubner/5a061b812b1bef75677d492ece5cbf4a to your computer and use it in GitHub Desktop.
const fs = require('fs');
const path = require('path');
const resumoDir = path.join(__dirname, 'resumos');
fs.mkdirSync(resumoDir, { recursive: true });
function write_pending_follow_requests() {
const data = require('./connections/followers_and_following/pending_follow_requests.json');
const pending_follow_requests = data
.relationships_follow_requests_sent
.map((el) => {
return el.string_list_data[0].href;
});
const filename = path.join(resumoDir, 'pending_follow_requests.json');
fs.writeFileSync(filename, JSON.stringify(pending_follow_requests, null, 2));
}
function write_not_foloow_me() {
const followers_1 = require('./connections/followers_and_following/followers_1.json');
const following = require('./connections/followers_and_following/following.json');
const cleaned_followers = followers_1.map((el) => el.string_list_data[0].href);
const cleaned_following = following.relationships_following.map((el) => el.string_list_data[0].href);
const not_follow_me = cleaned_following.filter((el) => !cleaned_followers.includes(el));
const filename = path.join(resumoDir, 'not_follow_me.json');
fs.writeFileSync(
filename,
JSON.stringify(not_follow_me, null, 2)
);
}
write_pending_follow_requests();
write_not_foloow_me();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment