Skip to content

Instantly share code, notes, and snippets.

View diousk's full-sized avatar

David diousk

  • Taipei
View GitHub Profile
@diousk
diousk / StoreLruFileSystem.java
Created November 8, 2018 14:40 — forked from saket/StoreLruFileSystem.java
A FileSystem for NYT-Store that uses DiskLruCache
import com.jakewharton.disklrucache.DiskLruCache;
import com.nytimes.android.external.fs3.filesystem.FileSystem;
import com.nytimes.android.external.store3.base.RecordState;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
@diousk
diousk / offset.md
Created December 12, 2024 16:08 — forked from hexcowboy/offset.md
Twitch Helix API - Get Video/VOD Offset and Comments from Clip ID

Since Twitch decomissioned API V5, there's no correct way to get the VOD offset for a clip. So I just inspected what the Twitch web app was doing and came up with a super cool hack.

I know this looks really complicated but really it just does two things. First it gets the clip information from the official API, then it uses Twitch GraphQL API to get the offset.

kimne78kx3ncx6brgo4mv6wki5h1ko is the Client ID that the Twitch web app uses. It can be used to access Twitch's GraphQL API (undocumented & not for public use). The postData variable contains a request and a sha256Hash. The sha256Hash is basically a job ID and may change in the future, but I added the current hash which should work for all clips as of posting this.

const clientId = "" // Put your Twitch Client ID here
const clientSecret = "" // Put your Twitch Client Secret here