diff --git a/main.go b/main.go index 3fd0c2a..3173abc 100644 --- a/main.go +++ b/main.go @@ -49,9 +49,9 @@ func probeTwitter(ctx context.Context, target string, registry *prometheus.Regis } func twitterHandler(w http.ResponseWriter, r *http.Request) { - username := r.URL.Query().Get("username") - if username == "" { - http.Error(w, "username parameter is missing", http.StatusBadRequest) + screenName := r.URL.Query().Get("screen_name") + if screenName == "" { + http.Error(w, "screen_name parameter is missing", http.StatusBadRequest) return } @@ -60,7 +60,7 @@ func twitterHandler(w http.ResponseWriter, r *http.Request) { ctx, cancel := context.WithTimeout(r.Context(), time.Duration(5*time.Second)) defer cancel() - if success := probeTwitter(ctx, username, reg); !success { + if success := probeTwitter(ctx, screenName, reg); !success { log.Error("Probe failed!") } diff --git a/readme.md b/readme.md index b6b0ba2..590cc1e 100644 --- a/readme.md +++ b/readme.md @@ -9,4 +9,4 @@ A very simple prometheus exporter for getting the follower count of twitter acco - `/probe?screen_name=foo` - the follower count for twitter user with screen name foo # How it do -Uses the `https://cdn.syndication.twimg.com/widgets/followbutton/info.json` *unauthenticated* JSON API. Twitter may well turn this off or rate limit aggressively. \ No newline at end of file +Uses the `https://cdn.syndication.twimg.com/widgets/followbutton/info.json` *unauthenticated* JSON API. Twitter may well turn this off or rate limit aggressively.