diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 197f5801..2fca2794 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -3,23 +3,21 @@ on: push: pull_request: schedule: - - cron: '0 5 * * *' + - cron: "0 5 * * *" jobs: - test: name: Test runs-on: ubuntu-latest steps: + - name: Set up Go 1.16 + uses: actions/setup-go@v3 + with: + go-version: 1.16 + id: go - - name: Set up Go 1.16 - uses: actions/setup-go@v3 - with: - go-version: 1.16 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v3 + - name: Check out code into the Go module directory + uses: actions/checkout@v3 - - name: Test - run: go test -v -run '^(TestGetGuestToken|TestLoginOpenAccount|TestGetProfile|TestGetProfilePrivate|TestGetProfileErrorSuspended|TestGetProfileErrorNotFound|TestGetUserIDByScreenName|TestGetTweets)$' + - name: Test + run: go test -v diff --git a/.vscode/settings.json b/.vscode/settings.json index 0a8b2eb4..18ede8a3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,28 +1,35 @@ -{ - // Most test requiers some auth, prefer using auth token to prevent get banned. - "go.testEnvVars": { - // Skip all tests that requires auth - "SKIP_AUTH_TEST": "", +// { +// // Most test requiers some auth, prefer using auth token to prevent get banned. +// "go.testEnvVars": { +// // Skip all tests that requires auth +// "SKIP_AUTH_TEST": "", - // Test auth token - "AUTH_TOKEN": "", - "CT0": "", +// // Test auth token +// // "AUTH_TOKEN": "309b9eb446fbad82953cab17bf8b79df1375fe46", +// // "CT0": "f5cd1a201f91f7aa8e0e47b0e38a18ecacaa9675efbb0b870eec669722f799bcfa583606d72b31213ff672220ad9bffa919bbde7f0f7097dd8e3790c472a208151cdfece3328b2fc32a1a011c7937550", - // Test auth with cookies - "COOKIES": "", +// // "AUTH_TOKEN": "95c88b5f112651c55ffa6eff9716e0f55412cbc2", +// // "CT0": "38588014e39748ce2059cfb46c08fd234a8329f63036d7a63b4653e006cda60d6d456d02901d0922a8ca8eed12e7baa56fa7ec3a67603a0894a6d8b06493df4bc76f2c289e2f4ec874665e5c3467215b", - // Test login & password - "TWITTER_USERNAME": "", - "TWITTER_PASSWORD": "", - "TWITTER_EMAIL": "", +// // 0h5imw token +// "AUTH_TOKEN": "37046d65d2128d54ddceb3492bdd1d846b1c9083", +// "CT0": "97f5914f37d6bd4f4d8fc6e94b1cbfad1322f2b05dc5b1aa2923ef2f7d1bcdb97b91ffa2ae1b1c1c998a97ef6e101990010be42d1bb8bc834778d47cedcd3084b53d131db3bd2cd9be758b69c68fbb6f", - // Test open account - "TEST_OPEN_ACCOUNT": "", - "OAUTH_TOKEN": "", - "OAUTH_SECRET": "", +// // Test auth with cookies +// "COOKIES": "", - // Test with proxy - "PROXY": "", - "PROXY_REQUIRED": "" - } -} +// // Test login & password +// "TWITTER_USERNAME": "", +// "TWITTER_PASSWORD": "", +// "TWITTER_EMAIL": "", + +// // Test open account +// "TEST_OPEN_ACCOUNT": "", +// "OAUTH_TOKEN": "", +// "OAUTH_SECRET": "", + +// // Test with proxy +// "PROXY": "socks5://NYxqaq:ZHbhqx@134.195.152.107:9757", +// "PROXY_REQUIRED": "yes" +// } +// } diff --git a/api.go b/api.go index fb6dfcf5..0bcf6697 100644 --- a/api.go +++ b/api.go @@ -57,6 +57,8 @@ func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error { return err } + // fmt.Println(string(content)) + statusOK := resp.StatusCode >= 200 && resp.StatusCode < 300 if !statusOK { return fmt.Errorf("response status %s: %s", resp.Status, content) diff --git a/util.go b/util.go index 8e21c38a..0b6881cd 100644 --- a/util.go +++ b/util.go @@ -380,6 +380,7 @@ func parseProfileV2(user userResult) Profile { FollowingCount: u.FavouritesCount, FriendsCount: u.FriendsCount, IsVerified: u.Verified, + // IsPrivate: u., LikesCount: u.FavouritesCount, ListedCount: u.ListedCount, Location: u.Location,