News for hackers. Stuff that matters.
Re:Is Ben scrolling TikTok right now? by positr0n on Saturday August 17, 2024 @12:27AM (#41272183)
I'm interested in what APIs he used to build this.
Re:Is Ben scrolling TikTok right now? by learningmore on Saturday August 17, 2024 @01:31AM (#41272319)
Agreed. There seems to be an “Research API” for TikTok that is available[1]. I’d like to find an API to query to track my youtube consumption.

[1] https://developers.tiktok.com/doc/research-api-get-started

Re:Is Ben scrolling TikTok right now? by captn3m0 on Saturday August 17, 2024 @01:32AM (#41272320)
I’m guessing just the DNS lookups for TikTok app might be unique enough.
Re:Is Ben scrolling TikTok right now? by bengrosser on Saturday August 17, 2024 @09:15AM (#41274346)
Hey, it's pretty simple. I use a shortcut on my iPhone that gets the contents of different firebase URLs when I open and when I close TikTok. I have a function on firebase that processes those URL visits, setting the values of a status node (isScrolling, platform, and a timestamp) and logging each request. Then each change to the firebase updates any clients loaded from https://stuckinthescroll.com. The time elapsed is counted up on page load from the log entries.

It's turned out to be quite robust so far. The only quirks happen when: 1) I forget to close TikTok before turning off the screen on my phone (which incorrectly leaves a log entry that doesn't get closed until the next entry), and 2) if I go into picture-in-picture mode (which incorrectly--IMO--triggers the app closed shortcut). For now I'm avoiding PiP, so that's not a big deal. As for unclosed log entries, I've gotten good about closing the app before turning off the screen, but there's a few entries in the data from before I trained myself (those are adding a small bit of slop to the total).