Add banner photo in profile

This commit is contained in:
Alexander Sheiko 2020-06-15 15:17:08 +03:00
parent 7e8d3badb4
commit 87fdf1c10e
2 changed files with 3 additions and 0 deletions

View file

@ -13,6 +13,7 @@ import (
// Profile of twitter user.
type Profile struct {
Avatar string
Banner string
Biography string
Birthday string
FollowersCount int
@ -65,6 +66,7 @@ func GetProfile(username string) (Profile, error) {
return Profile{
Avatar: doc.Find(".ProfileAvatar-image").First().AttrOr("src", ""),
Banner: doc.Find(".ProfileCanopy-headerBg img").First().AttrOr("src", ""),
Biography: doc.Find(".ProfileHeaderCard-bio.u-dir").First().Text(),
Birthday: strings.ReplaceAll(strings.TrimSpace(doc.Find(".ProfileHeaderCard-birthdateText.u-dir").First().Text()), "Born ", ""),
FollowersCount: parseCount(doc.Find(".ProfileNav-item--followers > a > span.ProfileNav-value").First()),