lay295 / TwitchDownloader

Twitch VOD/Clip Downloader - Chat Download/Render/Replay
MIT License
2.64k stars 260 forks source link

Add support for highlight collections #546

Open WeichhartEric opened 1 year ago

WeichhartEric commented 1 year ago

Checklist

Write your feature request here

Twitch has a feature where you can do a collection of highlighted streams and uploaded videos, which I believe it has a maximum of 100 items each.

You basically get a link like this one: https://www.twitch.tv/collections/(id)

While it is possible to access the collection to grab each link and use the mass downloader, it would be a time saver if just adding the collection was supported.

ScrubN commented 1 year ago

Highlights are mixed with regular VODs in the VOD Mass Downloader sorted by date.

image

As far as I can tell the single API request we currently make does not provide information on whether a given video is a highlight or not, just that it exists and metadata like id, views, length, etc.

ScrubN commented 1 year ago

Oh I missed the part about collections, I'll reopen

ScrubN commented 1 year ago

The API endpoints we query aren't officially documented anywhere so I'm not entirely sure if we can figure this out but hopefully we do at some point.

lay295 commented 1 year ago

Could probably use this query. There is their old schema floating around but they disabled their introspection query so it probably won't ever be updated

https://raw.githubusercontent.com/SuperSonicHub1/twitch-graphql-api/master/schema.graphql

"""Get a single collection (playlist) item by its ID."""
  collection(id: ID!, options: CollectionOptions): Collection
Valgard commented 2 months ago

I'm not a C# developer, but the following GraphQL query should do the job:

query Collection {
    collection(id: "Eb9h5skuhRecGg") {
        id
        title
        items(first: 50) {
            edges {
                node {
                    ... on Video {
                        id
                        title
                        thumbnailURLs(height: 180, width: 320)
                        createdAt
                        lengthSeconds
                        owner {
                            id
                            displayName
                        }
                        viewCount
                        game {
                            id
                            displayName
                            boxArtURL
                        }
                        description
                    }
                }
                cursor
            }
            totalCount
            pageInfo {
                hasNextPage
                hasPreviousPage
            }
        }
        description
        lengthSeconds
        owner {
            displayName
            id
        }
        thumbnailURL(width: 320, height: 180)
        updatedAt
        viewCount
        type
    }
}