Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SoBooks website URL to sobooks.cc #25

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ by your running environment.
|--------------------------------------------------|----------------------------------------|-----------------|----------------------------------------|-----------------------------------|----------------------------------|
| [智慧教育平台](#download-textbooks-for-kids) | <https://basic.smartedu.cn/tchMaterial> | ✅ | ❌ | ❌ | ❌ |
| [Talebook](#download-books-from-talebook) | <https://github.com/talebook/talebook> | ✅ | ❌ | ❌ | ❌ |
| [SoBooks](#download-books-from-sobooks) | <https://sobooks.net> | ✅ | ❌ | ✅ | ❌ |
| [SoBooks](#download-books-from-sobooks) | <https://sobooks.cc> | ✅ | ❌ | ✅ | ❌ |
| [Telegram](#download-books-from-telegram-groups) | <https://t.me> | ✅ | ❌ | ❌ | ❌ |
| [Hsu Life](#download-books-from-hsu-life) | <https://book.hsu.life> | ✅ | ❌ | ❌ | ❌ |

Expand Down
2 changes: 1 addition & 1 deletion cmd/flags/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var (

// SoBooks configurations.

SoBooksCode = "844283"
SoBooksCode = "244152"
)

func NewClientConfig() (*client.Config, error) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/sobooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (

const (
lowestSobooksBookID = 18000
sobooksWebsite = "https://sobooks.net"
sobooksWebsite = "https://sobooks.cc"
)

// sobooksCmd used for download books from sobooks.net
// sobooksCmd used for download books from sobooks.cc
var sobooksCmd = &cobra.Command{
Use: "sobooks",
Short: "A tool for downloading books from sobooks.net",
Short: "A tool for downloading books from sobooks.cc",
Run: func(cmd *cobra.Command, args []string) {
// Set the default start index.
if flags.InitialBookID < lowestSobooksBookID {
Expand Down
2 changes: 1 addition & 1 deletion internal/sobooks/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
driver.DIRECT: "备份",
}
dateRe = regexp.MustCompile(`(?m)(\d{4})-(\d{2})-(\d{2})`)
linkRe = regexp.MustCompile(`(?m)https://sobooks\.net/go\.html\?url=(.*?)"(.*?[::]\s?(\w+))?`)
linkRe = regexp.MustCompile(`(?m)https://sobooks\.cc/go\.html\?url=(.*?)"(.*?[::]\s?(\w+))?`)
)

type BookLink struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/sobooks/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import (
)

func TestParseSobooksUrl(t *testing.T) {
client := resty.New().SetBaseURL("https://sobooks.net")
client := resty.New().SetBaseURL("https://sobooks.cc")

// unsupported 14320 11000
// 20081 16899 16240
id := int64(18021)
resp, err := client.R().
SetCookie(&http.Cookie{
Name: "mpcode",
Value: "844283",
Value: "244152",
Path: "/",
Domain: "sobooks.net",
Domain: "sobooks.cc",
}).
SetPathParam("bookId", strconv.FormatInt(id, 10)).
SetHeader("referer", client.BaseURL).
Expand Down
Loading