diff --git a/profile.go b/profile.go index 2c2e476..2c6daa2 100644 --- a/profile.go +++ b/profile.go @@ -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()), diff --git a/profile_test.go b/profile_test.go index a268845..3f55b82 100644 --- a/profile_test.go +++ b/profile_test.go @@ -13,6 +13,7 @@ func TestGetProfile(t *testing.T) { joined := time.Date(2007, 02, 20, 6, 35, 0, 0, loc) sample := Profile{ Avatar: "https://pbs.twimg.com/profile_images/1270500941498912768/W-80pLvu_400x400.jpg", + Banner: "https://pbs.twimg.com/profile_banners/783214/1590856275/1500x500", Biography: "Black queer lives matter.\nBlack trans lives matter.\n#BlackLivesMatter", Birthday: "March 21", IsPrivate: false,