Skip to content

Commit

Permalink
run all available test in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
imperatrona committed Mar 9, 2024
1 parent 336cb53 commit 69a340b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 35 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
53 changes: 30 additions & 23 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"
// }
// }
2 changes: 2 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 69a340b

Please sign in to comment.