Skip to content

Instantly share code, notes, and snippets.

@autch
Created December 18, 2019 15:26
Show Gist options
  • Save autch/8ec6ff593961dd44424c1cd0c2b5d59f to your computer and use it in GitHub Desktop.
Save autch/8ec6ff593961dd44424c1cd0c2b5d59f to your computer and use it in GitHub Desktop.
Twitterでフォローしているアカウントのうち、まだWebカタログでお気にしてないアカウントを抽出
const fs = require('fs');
// https://app.ecocorogy.com/eventlist/ から落とせる「完了ファイル」
const friendsList = JSON.parse(fs.readFileSync('friendslist.txt', {encoding: 'utf8'}));
// https://webcatalog.circle.ms/User/Twitter から落とせる「お気に入りアカウント一覧」
const comikeFavAccountList = fs.readFileSync('comikeFavAccount.txt', {encoding: 'utf8'}).split(/\r?\n/);
// https://app.ecocorogy.com/eventlist/ の結果から以下の bookmarklet で得られる JSON
// JSON.stringify(Array.from(document.querySelectorAll('div[userid]'), i => i.getAttribute('userid')))
const detectedAccountList = JSON.parse(fs.readFileSync('detected_accounts.json', {encoding: 'utf8'}));
// 全フォロー中一覧から、Web カタログでお気にしたアカウントを除外
let residue = friendsList.users.filter(i => comikeFavAccountList.indexOf(i.screen_name) === -1);
// 残りのアカウントのうち、eventlist でブース名を検知できたアカウントだけを残す
residue = residue.filter(i => detectedAccountList.indexOf(i.id_str) !== -1);
// カタログ未チェックのアカウントだけが残るはず
console.log(JSON.stringify(residue));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment