Skip to content

Commit

Permalink
simplify extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Aug 21, 2022
1 parent 098d387 commit d357b1b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions pkg/extractor/v6/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"github.com/alaingilbert/ogame/pkg/ogame"
"net/url"
"regexp"
"time"

"github.com/PuerkitoBio/goquery"
Expand Down Expand Up @@ -89,14 +88,7 @@ func (e *Extractor) ExtractExpeditionMessagesFromDoc(doc *goquery.Document) ([]o

// ExtractLifeformEnabled ...
func (e *Extractor) ExtractLifeformEnabled(pageHTML []byte) bool {
lifeformEnabledMatch := regexp.MustCompile(`"lifeformEnabled":(\btrue\b|\bfalse\b)`).FindSubmatch(pageHTML)
if len(lifeformEnabledMatch) < 2 {
return false
}
if bytes.Equal(lifeformEnabledMatch[1], []byte("true")) {
return true
}
return false
return bytes.Contains(pageHTML, []byte(`lifeformEnabled":true`))
}

// ExtractIsInVacation ...
Expand Down

0 comments on commit d357b1b

Please sign in to comment.