-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from littleneko/dev
Dev
- Loading branch information
Showing
8 changed files
with
1,212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
# pixiv-api-go | ||
|
||
A pixiv ajax(web) api | ||
|
||
## How to Use | ||
|
||
```go | ||
package main | ||
|
||
import "github.com/littleneko/pixiv-api-go" | ||
|
||
func main() { | ||
|
||
client := pixiv_api_go.NewPixivClient(5000) | ||
client.SetUserAgent("") | ||
client.SetCookiePHPSESSID("") | ||
|
||
illusts, _ := client.GetIllustInfo("107157430", false) | ||
for illust := range illusts { | ||
println(illust) | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package pixiv_api_go | ||
|
||
const ( | ||
IllustRankModeDaily IllustRankMode = "daily" // 今日 | ||
IllustRankModeWeekly IllustRankMode = "weekly" // 本周 | ||
IllustRankModeMonthly IllustRankMode = "monthly" // 本月 | ||
IllustRankModeRookie IllustRankMode = "rookie" // 新人 | ||
IllustRankModeDailyAi IllustRankMode = "daily_ai" // AI 生成 | ||
IllustRankModeMale IllustRankMode = "male" // 受男性欢迎 | ||
IllustRankModeFemale IllustRankMode = "female" // 受女性欢迎 | ||
IllustRankModeDailyR18 IllustRankMode = "daily_r18" | ||
IllustRankModeWeeklyR18 IllustRankMode = "weekly_r18" | ||
IllustRankModeDailyR18Ai IllustRankMode = "daily_r18_ai" | ||
IllustRankModeMaleR18 IllustRankMode = "male_r18" | ||
IllustRankModeFemaleR18 IllustRankMode = "female_r18" | ||
IllustRankModeR18g IllustRankMode = "r18g" | ||
) | ||
|
||
const ( | ||
IllustRankContentAll IllustRankContent = "all" // 综合 | ||
IllustRankContentIllust IllustRankContent = "illust" // 插画 | ||
IllustRankContentUgoira IllustRankContent = "ugoira" // 动图 | ||
IllustRankContentManga IllustRankContent = "manga" // 漫画 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package pixiv_api_go | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
) | ||
|
||
var ( | ||
// ErrNotFound means the api return 404 | ||
ErrNotFound = errors.New("NotFound") | ||
) | ||
|
||
type ErrorJsonUnmarshal struct { | ||
err error | ||
rawStr string | ||
} | ||
|
||
func NewJsonUnmarshalErr(date []byte, err error) error { | ||
return &ErrorJsonUnmarshal{err: err, rawStr: string(date)} | ||
} | ||
|
||
func (j *ErrorJsonUnmarshal) Error() string { | ||
return fmt.Sprintf("failed to unmarshal json, err: %s, raw: %s", j.err, j.rawStr) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module pixiv-api-go | ||
|
||
go 1.19 |
Oops, something went wrong.