|
|
@ -686,8 +686,6 @@ func authTwitter(url string) (string, string, common.Address, error) { |
|
|
|
if len(parts) < 4 || parts[len(parts)-2] != "status" { |
|
|
|
if len(parts) < 4 || parts[len(parts)-2] != "status" { |
|
|
|
return "", "", common.Address{}, errors.New("Invalid Twitter status URL") |
|
|
|
return "", "", common.Address{}, errors.New("Invalid Twitter status URL") |
|
|
|
} |
|
|
|
} |
|
|
|
username := parts[len(parts)-3] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Twitter's API isn't really friendly with direct links. Still, we don't
|
|
|
|
// Twitter's API isn't really friendly with direct links. Still, we don't
|
|
|
|
// want to do ask read permissions from users, so just load the public posts and
|
|
|
|
// want to do ask read permissions from users, so just load the public posts and
|
|
|
|
// scrape it for the Ethereum address and profile URL.
|
|
|
|
// scrape it for the Ethereum address and profile URL.
|
|
|
@ -697,6 +695,13 @@ func authTwitter(url string) (string, string, common.Address, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
defer res.Body.Close() |
|
|
|
defer res.Body.Close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Resolve the username from the final redirect, no intermediate junk
|
|
|
|
|
|
|
|
parts = strings.Split(res.Request.URL.String(), "/") |
|
|
|
|
|
|
|
if len(parts) < 4 || parts[len(parts)-2] != "status" { |
|
|
|
|
|
|
|
return "", "", common.Address{}, errors.New("Invalid Twitter status URL") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
username := parts[len(parts)-3] |
|
|
|
|
|
|
|
|
|
|
|
body, err := ioutil.ReadAll(res.Body) |
|
|
|
body, err := ioutil.ReadAll(res.Body) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return "", "", common.Address{}, err |
|
|
|
return "", "", common.Address{}, err |
|
|
|