Created
May 10, 2021 09:03
-
-
Save MrMarble/140d21d15e85c491ea809831bf7bfce9 to your computer and use it in GitHub Desktop.
Get all followed on twtich.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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