Merge remote-tracking branch 'master/master' into pr/1
# Conflicts: # go.mod
This commit is contained in:
commit
fcb4411c18
4 changed files with 4 additions and 4 deletions
2
go.mod
2
go.mod
|
|
@ -1,4 +1,4 @@
|
||||||
module github.com/tolantop/twitter-scraper
|
module github.com/n0madic/twitter-scraper
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@ func TestGetTrends(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(trends) != 10 {
|
if len(trends) != 10 {
|
||||||
t.Error("Expected 10 trends")
|
t.Errorf("Expected 10 trends, got %d: %#v", len(trends), trends)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ type Result struct {
|
||||||
|
|
||||||
// GetTweets returns channel with tweets for a given user
|
// GetTweets returns channel with tweets for a given user
|
||||||
func GetTweets(user string, pages int) <-chan *Result {
|
func GetTweets(user string, pages int) <-chan *Result {
|
||||||
channel := make(chan *Result, 0)
|
channel := make(chan *Result)
|
||||||
go func(user string) {
|
go func(user string) {
|
||||||
defer close(channel)
|
defer close(channel)
|
||||||
var lastTweetID string
|
var lastTweetID string
|
||||||
|
|
|
||||||
2
util.go
2
util.go
|
|
@ -26,7 +26,7 @@ func getHTMLFromJSON(req *http.Request, field string) (*strings.Reader, error) {
|
||||||
|
|
||||||
htm, ok := ajaxJSON[field].(string)
|
htm, ok := ajaxJSON[field].(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("filed not found in JSON")
|
return nil, fmt.Errorf("field not found in JSON")
|
||||||
}
|
}
|
||||||
|
|
||||||
return strings.NewReader(htm), nil
|
return strings.NewReader(htm), nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue