Twitch API ## Что есть ### Channel info * Ссылки на другие соцсети (только парсить) * Возможно, рекламные баннеры (только парсить) ![](https://i.imgur.com/V9XuGWJ.png) <details> <summary style="font-size:14px">Response JSON</summary> ``` { "data":[ { "broadcaster_id":"25604128", "broadcaster_login":"guit88man", "broadcaster_name":"guit88man", "broadcaster_language":"ru", "game_id":"187", "game_name":"X-COM: UFO Defense", "title":"!лига !tg XCOM", "delay":0 } ] } ``` </details> ### Videolist Информация о трансляции: * дата начала * Название, часто с тегами вида !что-то * продолжительность * количество зрителей * язык <details> <summary style="font-size:14px">Response JSON</summary> ``` { "data":[ { "id":"1578832945", "stream_id":"46011679788", "user_id":"25604128", "user_login":"guit88man", "user_name":"guit88man", "title":"!лига !tg Танки -\u003e Элденское", "description":"", "created_at":"2022-09-01T15:27:21Z", "published_at":"2022-09-01T15:27:21Z", "url":"https://www.twitch.tv/videos/1578832945", "thumbnail_url":"https://static-cdn.jtvnw.net/cf_vods/dgeft87wbj63p/24dcf087f664003d9148_guit88man_46011679788_1662046036//thumb/thumb0-%{width}x%{height}.jpg", "viewable":"public", "view_count":23512, "language":"ru", "type":"archive", "duration":"4h18m40s", "muted_segments":null } ], "pagination":{ "cursor":"eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MjB9fQ" } } ``` </details> <br> зная id трансляции можно сделать доп. запрос для получения игры (типизировано, есть id) ![](https://i.imgur.com/EufDl3A.png) <details> <summary style="font-size:14px">Request</summary> ``` curl 'https://gql.twitch.tv/gql' \ -H 'Client-Id: kimne78kx3ncx6brgo4mv6wki5h1ko' \ -H 'Content-Type: text/plain;charset=UTF-8' \ --data-raw '[{"operationName":"CharityButtonSubscriptionStatus","variables":{"channelId":"25604128","channelLogin":"guit88man"},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"c6990c32e13f2b2899ad091fa903449e8e3f28c64cb0071571fb32e5e2b79aad"}}},{"operationName":"VideoMetadata","variables":{"channelLogin":"guit88man","videoID":"1578832945"},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"49b5b8f268cdeb259d75b58dcb0c1a748e3b575003448a2333dc5cdafd49adad"}}}]' \ ``` </details> <details> <summary style="font-size:14px">Response JSON</summary> ``` [ { "data":{ "user":{ "id":"25604128", "roles":{ "isAffiliate":false, "isPartner":true, "__typename":"UserRoles" }, "__typename":"User" }, "channel":{ "id":"25604128", "activeCharityCampaign":null, "__typename":"Channel" } }, "extensions":{ "durationMilliseconds":38, "operationName":"CharityButtonSubscriptionStatus", "requestID":"01GD601H3YR0XA6R0RH89WJMXP" } }, { "data":{ "user":{ "id":"25604128", "primaryColorHex":"FA2929", "isPartner":true, "profileImageURL":"https://static-cdn.jtvnw.net/jtv_user_pictures/db57905e-f397-4723-b311-3d2ad0bfaba0-profile_image-70x70.png", "lastBroadcast":{ "id":"46068343132", "startedAt":"2022-09-17T00:35:59.761808Z", "__typename":"Broadcast" }, "__typename":"User" }, "currentUser":null, "video":{ "id":"1578832945", "title":"!лига !tg Танки -\u003e Элденское", "description":null, "previewThumbnailURL":"https://static-cdn.jtvnw.net/cf_vods/dgeft87wbj63p/24dcf087f664003d9148_guit88man_46011679788_1662046036//thumb/thumb0-90x60.jpg", "createdAt":"2022-09-01T15:27:21Z", "viewCount":23650, "publishedAt":"2022-09-01T15:27:21Z", "lengthSeconds":15520, "broadcastType":"ARCHIVE", "owner":{ "id":"25604128", "login":"guit88man", "displayName":"guit88man", "__typename":"User" }, "game":{ "id":"27546", "boxArtURL":"https://static-cdn.jtvnw.net/ttv-boxart/27546-{width}x{height}.jpg", "name":"World of Tanks", "displayName":"World of Tanks", "__typename":"Game" }, "__typename":"Video" } }, "extensions":{ "durationMilliseconds":38, "operationName":"VideoMetadata", "requestID":"01GD601H3YR0XA6R0RH89WJMXP" } } ] ``` </details> ### User follows * общее количество каналов, которые фолловит пользователь * follow channel id * дата подписки <details> <summary style="font-size:14px">Response JSON</summary> ``` { "total": 12345, "data": [ { "from_id": "171003792", "from_login": "iiisutha067iii", "from_name": "IIIsutha067III", "to_id": "23161357", "to_name": "LIRIK", "followed_at": "2017-08-22T22:55:24Z" }, { "from_id": "113627897", "from_login": "birdman616", "from_name": "Birdman616", "to_id": "23161357", "to_name": "LIRIK", "followed_at": "2017-08-22T22:55:04Z" }, ... ], "pagination":{ "cursor": "eyJiIjpudWxsLCJhIjoiMTUwMzQ0MTc3NjQyNDQyMjAwMCJ9" } } ``` </details> ### Followed Streams * общее количество пользователей подписанных на канал * id пользователя * дата подписки ## Как можно использовать 1. ☆ Получить топ популярных игр у стримера (за неделю, месяц, год) ![](https://i.imgur.com/8hzrH1k.png) 2. ☆ Сравнение аудитории. Топ-5 пересечений с другими стримерами по подписчикам. Или кто стримит те же игры ![](https://i.imgur.com/rlUl9Mh.png) 3. ☉ Посмотреть "сообщества" стримеров. Кто на кого подписан из топ-500+ ![](https://i.imgur.com/gR4TALx.png)