|
|
|
@ -591,13 +591,13 @@ class DLiveChannel extends Channel {
|
|
|
|
|
this.chat.api.post({
|
|
|
|
|
operationName: 'LivestreamPageRefetch',
|
|
|
|
|
variables: {
|
|
|
|
|
displayname: this.username
|
|
|
|
|
username: this.username
|
|
|
|
|
},
|
|
|
|
|
query: `
|
|
|
|
|
query LivestreamPageRefetch(
|
|
|
|
|
$displayname: String!
|
|
|
|
|
$username: String!
|
|
|
|
|
) {
|
|
|
|
|
userByDisplayName(displayname: $displayname) {
|
|
|
|
|
user(username: $username) {
|
|
|
|
|
livestream {
|
|
|
|
|
watchingCount
|
|
|
|
|
}
|
|
|
|
@ -605,31 +605,127 @@ class DLiveChannel extends Channel {
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}).then((data) => {
|
|
|
|
|
resolve({ viewers: data.userByDisplayName.livestream && data.userByDisplayName.livestream.watchingCount, platform: this.chat.getPlatformName() });
|
|
|
|
|
resolve({ viewers: data.user.livestream && data.user.livestream.watchingCount, platform: this.chat.getPlatformName() });
|
|
|
|
|
}, reject);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getStatus() {
|
|
|
|
|
getStatus(original) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
this.chat.api.post({
|
|
|
|
|
operationName: 'LivestreamPageRefetch',
|
|
|
|
|
variables: {
|
|
|
|
|
displayname: this.username
|
|
|
|
|
username: this.username
|
|
|
|
|
},
|
|
|
|
|
query: `
|
|
|
|
|
query LivestreamPageRefetch(
|
|
|
|
|
$displayname: String!
|
|
|
|
|
$username: String!
|
|
|
|
|
) {
|
|
|
|
|
userByDisplayName(displayname: $displayname) {
|
|
|
|
|
user(username: $username) {
|
|
|
|
|
avatar
|
|
|
|
|
chatDisabled
|
|
|
|
|
chatInterval
|
|
|
|
|
chatLinkDisabled
|
|
|
|
|
chatMode
|
|
|
|
|
chatVerifiedOnly
|
|
|
|
|
displayname
|
|
|
|
|
donateDisabled
|
|
|
|
|
effect
|
|
|
|
|
followChatDelay
|
|
|
|
|
isFollowing
|
|
|
|
|
isMe
|
|
|
|
|
isSubscribing
|
|
|
|
|
followers {
|
|
|
|
|
totalCount
|
|
|
|
|
}
|
|
|
|
|
following {
|
|
|
|
|
totalCount
|
|
|
|
|
}
|
|
|
|
|
ongoingGiftSub {
|
|
|
|
|
gifter {
|
|
|
|
|
displayname
|
|
|
|
|
id
|
|
|
|
|
username
|
|
|
|
|
avatar
|
|
|
|
|
}
|
|
|
|
|
count
|
|
|
|
|
}
|
|
|
|
|
partnerStatus
|
|
|
|
|
role
|
|
|
|
|
subscribeDisabled
|
|
|
|
|
username
|
|
|
|
|
livestream {
|
|
|
|
|
id
|
|
|
|
|
permlink
|
|
|
|
|
title
|
|
|
|
|
totalReward
|
|
|
|
|
watchingCount
|
|
|
|
|
createdAt
|
|
|
|
|
category {
|
|
|
|
|
id
|
|
|
|
|
title
|
|
|
|
|
}
|
|
|
|
|
creator {
|
|
|
|
|
displayname
|
|
|
|
|
id
|
|
|
|
|
username
|
|
|
|
|
}
|
|
|
|
|
language {
|
|
|
|
|
id
|
|
|
|
|
language
|
|
|
|
|
}
|
|
|
|
|
thumbnailUrl
|
|
|
|
|
ageRestriction
|
|
|
|
|
earnRestriction
|
|
|
|
|
}
|
|
|
|
|
subSetting {
|
|
|
|
|
badgeColor
|
|
|
|
|
badgeText
|
|
|
|
|
benefits
|
|
|
|
|
streakTextColor
|
|
|
|
|
textColor
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`
|
|
|
|
|
}).then((data) => {
|
|
|
|
|
resolve({ viewers: data.userByDisplayName.livestream && data.userByDisplayName.livestream.watchingCount, platform: this.chat.getPlatformName() });
|
|
|
|
|
if(original) {
|
|
|
|
|
resolve(data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!data || !data.user) {
|
|
|
|
|
reject(data ? data : 'No data');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resolve({
|
|
|
|
|
platform: this.chat.getPlatformName(),
|
|
|
|
|
clientId: this.chat.id,
|
|
|
|
|
channelId: this.id,
|
|
|
|
|
user: {
|
|
|
|
|
avatar: data.user.avatar,
|
|
|
|
|
displayName: data.user.displayname,
|
|
|
|
|
followers: data.user.followers.totalCount,
|
|
|
|
|
following: data.user.following.totalCount,
|
|
|
|
|
},
|
|
|
|
|
stream: data.user.livestream ? {
|
|
|
|
|
isLive: true,
|
|
|
|
|
startTime: data.user.livestream.createdAt / 1000,
|
|
|
|
|
viewers: data.user.livestream.watchingCount,
|
|
|
|
|
title: data.user.livestream.title,
|
|
|
|
|
preview: data.user.livestream.thumbnailUrl,
|
|
|
|
|
language: data.user.livestream.language.language,
|
|
|
|
|
audienceType: data.user.livestream.ageRestriction ? 'X-Tag' : data.user.livestream.earnRestriction ? 'Mature-Tag' : null,
|
|
|
|
|
category: {
|
|
|
|
|
id: data.user.livestream.category.id,
|
|
|
|
|
name: data.user.livestream.category.title,
|
|
|
|
|
}
|
|
|
|
|
} : { isLive: false },
|
|
|
|
|
chat: {
|
|
|
|
|
interval: data.user.chatInterval
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, reject);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|