Skip to content

Instantly share code, notes, and snippets.



Created Jun 23, 2016
What would you like to do?
Scrape game information from GPSD site
package main
import (
func main() {
doc, _ := goquery.NewDocument("")
doc.Find("tr.GameRow").Each(func(i int, s *goquery.Selection) {
date := s.Find("").Text()
time := s.Find("td.time").Text()
opponent := s.Find("td.tm1 a").Text()
if opponent == "" {
opponent = s.Find("td.tm2 a").Text()
facility := s.Find("td.facility a").Text()
opponent = strings.TrimSpace(opponent)
facility = strings.TrimSpace(facility)
fmt.Printf("%s %s vs. %s at %s\n", date, time, opponent, facility)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.