Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Fixed the icon interface on the channel.
  • Loading branch information
yigit433 committed Feb 10, 2022
1 parent 00c2d2c commit 7e5af41
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ func ParseChannel(data interface{}) ChannelParser {
if data != nil {
navEndpoint := data.(map[string]interface{})["navigationEndpoint"]
url := fmt.Sprintf("https://www.youtube.com%s", navEndpoint.(map[string]interface{})["browseEndpoint"].(map[string]interface{})["canonicalBaseUrl"] || navEndpoint.(map[string]interface{})["commandMetadata"].(map[string]interface{})["webCommandMetadata"].(map[string]interface{})["url"])
thumbnail := data.(map[string]interface{})["thumbnail"].(map[string]interface{})["thumbnails"]
thumbnails := data.(map[string]interface{})["thumbnail"].(map[string]interface{})["thumbnails"]
thumbnail := thumbnails.([]interface{})[len(thumbnails.([]interface{}))-1]

var out ChannelParser
out = ChannelParser{
Id: data.(map[string]interface{})["channelId"].(string),
Url: url,
Name: data.(map[string]interface{})["title"].(map[string]interface{})["simpleText"].(string),
Icon: thumbnail.([]interface{})[len(thumbnail.([]interface{}))-1],
Id: data.(map[string]interface{})["channelId"].(string),
Url: url,
Name: data.(map[string]interface{})["title"].(map[string]interface{})["simpleText"].(string),
Icon: Thumbnail{
Url: thumbnail["url"],
Width: thumbnail["width"],
Height: thumbnail["height"],
},
Subscribers: data.(map[string]interface{})["subscriberCountText"].(map[string]interface{})["simpleText"],
}
} else {
Expand Down

0 comments on commit 7e5af41

Please sign in to comment.