Skip to content

Commit f41c66c

Browse files
authored
Keep the casing a streamer has (#7)
Co-authored-by: goproslowyo <[email protected]>
1 parent d3e95c2 commit f41c66c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

streamers/streamers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,13 @@ func (s *Streamer) GetUID() {
9898
// Check if response contains username
9999
if !strings.Contains(str_response, s.Name) {
100100
log.Printf("streamer hasn't streamed in a while! username not found, check spelling: %s, check twitch: https://www.twitch.tv/%s/schedule, stats: %s\n", s.Name, s.Name, url)
101+
return
101102
}
102103

104+
// Parse the body for '<span class="PageHeaderMiddleWithImageHeaderP1">'
105+
user_response := strings.Split(str_response, "<span class=\"PageHeaderMiddleWithImageHeaderP1\">")[1]
106+
// Remove everything after '</span>'
107+
user_response = strings.Split(user_response, "</span>")[0]
103108
// Parse the body for 'var PageInfo = '
104109
str_response = strings.Split(str_response, "var PageInfo = ")[1]
105110
// Split on ;
@@ -114,6 +119,7 @@ func (s *Streamer) GetUID() {
114119
// Set the SullyGnomeID
115120
id := fmt.Sprintf("%.0f", j["id"])
116121
s.SullyGnomeID = id
122+
s.Name = user_response
117123
}
118124

119125
// GetStats populates the Streamer struct's ThirtyDayStats field with 30-day streaming statistics.

0 commit comments

Comments
 (0)