Skip to content

Instantly share code, notes, and snippets.

@MrMarble
Created May 10, 2021 09:03
Show Gist options
  • Select an option

  • Save MrMarble/140d21d15e85c491ea809831bf7bfce9 to your computer and use it in GitHub Desktop.

Select an option

Save MrMarble/140d21d15e85c491ea809831bf7bfce9 to your computer and use it in GitHub Desktop.
Get all followed on twtich.js
"use strict";
function getFollowed() {
const dom = document.querySelector("div[aria-label='Canales que sigo']");
const key = Object.keys(dom).find((key) =>
key.startsWith("__reactInternalInstance$")
);
const react = dom[key];
if (react == null) return;
const walk = (obj, max = 30) => {
if (obj.key === "FOLLOWED_SECTION") {
return {
offline: obj.memoizedProps.section.videoConnections,
online: obj.memoizedProps.section.streams
};
}
if (--max > 0) return walk(obj.return);
};
return walk(react);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment