Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
bypass youtube info mixing
Browse files Browse the repository at this point in the history
  • Loading branch information
nikooo777 committed Mar 21, 2024
1 parent 7806d42 commit 9426d1f
Showing 1 changed file with 60 additions and 10 deletions.
70 changes: 60 additions & 10 deletions ytapi/ytapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ func ChannelInfo(channelID string, attemptNo int, ipPool *ip_manager.IPPool) (*Y
if err != nil {
return nil, errors.Err(err)
}
if decodedResponse.Header.C4TabbedHeaderRenderer.Avatar.Thumbnails == nil || len(decodedResponse.Header.C4TabbedHeaderRenderer.Avatar.Thumbnails) == 0 {
decodedResponse.Header.C4TabbedHeaderRenderer.Avatar.Thumbnails = decodedResponse.Header.PageHeaderRenderer.Content.PageHeaderViewModel.Image.DecoratedAvatarViewModel.Avatar.AvatarViewModel.Image.Sources
}
if decodedResponse.Header.C4TabbedHeaderRenderer.Banner.Thumbnails == nil || len(decodedResponse.Header.C4TabbedHeaderRenderer.Banner.Thumbnails) == 0 {
decodedResponse.Header.C4TabbedHeaderRenderer.Banner.Thumbnails = decodedResponse.Header.PageHeaderRenderer.Content.PageHeaderViewModel.Banner.ImageBannerViewModel.Image.Sources
}

return &decodedResponse, nil
}
Expand Down Expand Up @@ -229,6 +235,12 @@ func getVideos(channelID string, videoIDs []string, stopChan stop.Chan, ipPool *
return videos, nil
}

type thumb struct {
URL string `json:"url"`
Width int `json:"width"`
Height int `json:"height"`
}

type YoutubeStatsResponse struct {
Contents struct {
TwoColumnBrowseResultsRenderer struct {
Expand Down Expand Up @@ -288,22 +300,60 @@ type YoutubeStatsResponse struct {
} `json:"twoColumnBrowseResultsRenderer"`
} `json:"contents"`
Header struct {
PageHeaderRenderer struct {
PageTitle string `json:"pageTitle"`
Content struct {
PageHeaderViewModel struct {
Image struct {
DecoratedAvatarViewModel struct {
Avatar struct {
AvatarViewModel struct {
Image struct {
Sources []thumb `json:"sources"`
Processor struct {
BorderImageProcessor struct {
Circular bool `json:"circular"`
} `json:"borderImageProcessor"`
} `json:"processor"`
} `json:"image"`
AvatarImageSize string `json:"avatarImageSize"`
} `json:"avatarViewModel"`
} `json:"avatar"`
} `json:"decoratedAvatarViewModel"`
} `json:"image"`
Banner struct {
ImageBannerViewModel struct {
Image struct {
Sources []thumb `json:"sources"`
} `json:"image"`
Style string `json:"style"`
RendererContext struct {
LoggingContext struct {
LoggingDirectives struct {
TrackingParams string `json:"trackingParams"`
Visibility struct {
Types string `json:"types"`
} `json:"visibility"`
ClientVeSpec struct {
UiType int `json:"uiType"`
VeCounter int `json:"veCounter"`
} `json:"clientVeSpec"`
} `json:"loggingDirectives"`
} `json:"loggingContext"`
} `json:"rendererContext"`
} `json:"imageBannerViewModel"`
} `json:"banner"`
} `json:"pageHeaderViewModel"`
} `json:"content"`
} `json:"pageHeaderRenderer"`
C4TabbedHeaderRenderer struct {
ChannelID string `json:"channelId"`
Title string `json:"title"`
Avatar struct {
Thumbnails []struct {
URL string `json:"url"`
Width int `json:"width"`
Height int `json:"height"`
} `json:"thumbnails"`
Thumbnails []thumb `json:"thumbnails"`
} `json:"avatar"`
Banner struct {
Thumbnails []struct {
URL string `json:"url"`
Width int `json:"width"`
Height int `json:"height"`
} `json:"thumbnails"`
Thumbnails []thumb `json:"thumbnails"`
} `json:"banner"`
VisitTracking struct {
RemarketingPing string `json:"remarketingPing"`
Expand Down

0 comments on commit 9426d1f

Please sign in to comment.