Compare commits
2 Commits
2f91823161
...
5200126565
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5200126565 | ||
|
|
f93b07c87a |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "twitch-vod-manager",
|
"name": "twitch-vod-manager",
|
||||||
"version": "4.6.29",
|
"version": "4.6.30",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "twitch-vod-manager",
|
"name": "twitch-vod-manager",
|
||||||
"version": "4.6.29",
|
"version": "4.6.30",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.0",
|
"axios": "^1.6.0",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "twitch-vod-manager",
|
"name": "twitch-vod-manager",
|
||||||
"version": "4.6.29",
|
"version": "4.6.30",
|
||||||
"description": "Twitch VOD Manager - Download Twitch VODs easily",
|
"description": "Twitch VOD Manager - Download Twitch VODs easily",
|
||||||
"main": "dist/main.js",
|
"main": "dist/main.js",
|
||||||
"author": "xRangerDE",
|
"author": "xRangerDE",
|
||||||
|
|||||||
26
src/main.ts
26
src/main.ts
@ -2410,15 +2410,24 @@ interface PublicProfileQueryResult {
|
|||||||
} | null;
|
} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchPublicStreamerProfile(login: string): Promise<{
|
interface PublicStreamerProfileResult {
|
||||||
displayName: string;
|
displayName: string;
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
bannerUrl: string;
|
bannerUrl: string;
|
||||||
description: string;
|
description: string;
|
||||||
broadcasterType: '' | 'partner' | 'affiliate';
|
broadcasterType: '' | 'partner' | 'affiliate';
|
||||||
followerCount: number | null;
|
followerCount: number | null;
|
||||||
stream: { previewUrl: string; viewers: number | null; title: string | null; game: string | null } | null;
|
stream: PublicStreamInfo | null;
|
||||||
} | null> {
|
}
|
||||||
|
|
||||||
|
interface PublicStreamInfo {
|
||||||
|
previewUrl: string;
|
||||||
|
viewers: number | null;
|
||||||
|
title: string | null;
|
||||||
|
game: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchPublicStreamerProfile(login: string): Promise<PublicStreamerProfileResult | null> {
|
||||||
// Same query also pulls bannerImageURL and the current stream's
|
// Same query also pulls bannerImageURL and the current stream's
|
||||||
// preview + viewer count when live — saves a separate roundtrip.
|
// preview + viewer count when live — saves a separate roundtrip.
|
||||||
const data = await fetchPublicTwitchGql<PublicProfileQueryResult>(
|
const data = await fetchPublicTwitchGql<PublicProfileQueryResult>(
|
||||||
@ -2467,15 +2476,6 @@ async function fetchPublicStreamerProfile(login: string): Promise<{
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchOnlyFollowerCount(login: string): Promise<number | null> {
|
|
||||||
const data = await fetchPublicTwitchGql<PublicProfileQueryResult>(
|
|
||||||
`query($login: String!) { user(login: $login) { followers { totalCount } } }`,
|
|
||||||
{ login }
|
|
||||||
);
|
|
||||||
const cnt = data?.user?.followers?.totalCount;
|
|
||||||
return typeof cnt === 'number' ? cnt : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getStreamerProfile(login: string, forceRefresh = false): Promise<StreamerProfile | null> {
|
async function getStreamerProfile(login: string, forceRefresh = false): Promise<StreamerProfile | null> {
|
||||||
const normalized = normalizeLogin(login);
|
const normalized = normalizeLogin(login);
|
||||||
if (!normalized) return null;
|
if (!normalized) return null;
|
||||||
@ -2502,7 +2502,7 @@ async function getStreamerProfile(login: string, forceRefresh = false): Promise<
|
|||||||
let bannerUrl = '';
|
let bannerUrl = '';
|
||||||
let description = '';
|
let description = '';
|
||||||
let broadcasterType: '' | 'partner' | 'affiliate' = '';
|
let broadcasterType: '' | 'partner' | 'affiliate' = '';
|
||||||
let streamFromPublic: Awaited<ReturnType<typeof fetchPublicStreamerProfile>> extends infer R ? (R extends null ? null : R extends { stream: infer S } ? S : null) : null = null;
|
let streamFromPublic: PublicStreamInfo | null = null;
|
||||||
let followerCountFromPublic: number | null = null;
|
let followerCountFromPublic: number | null = null;
|
||||||
|
|
||||||
const publicProfile = await fetchPublicStreamerProfile(normalized);
|
const publicProfile = await fetchPublicStreamerProfile(normalized);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user