Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed Nov 17, 2023
1 parent 02cbc31 commit 843e0c5
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 85 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,42 +55,6 @@ jobs:
uses: actions/deploy-pages@v2


- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Build
run: |
go vet ./tools/tls_generator
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_linux_amd64 ./tools/tls_generator
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_linux_arm64 ./tools/tls_generator
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_darwin_amd64 ./tools/tls_generator
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_darwin_arm64 ./tools/tls_generator
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_windows_amd64.exe ./tools/tls_generator
- uses: actions/upload-artifact@v3
with:
path: ./releases/tls_generator_linux_amd64
- uses: actions/upload-artifact@v3
with:
path: ./releases/tls_generator_linux_arm64
- uses: actions/upload-artifact@v3
with:
path: ./releases/tls_generator_darwin_amd64
- uses: actions/upload-artifact@v3
with:
path: ./releases/tls_generator_darwin_arm64
- uses: actions/upload-artifact@v3
with:
path: ./releases/tls_generator_windows_amd64.exe


# build-tls-generator:
# runs-on: ubuntu-latest
#
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ tls_generator:
go vet ./tools/tls_generator
go build -ldflags "-s -w" -o ./releases/tls_generator ./tools/tls_generator

tls_generator_more:
go vet ./tools/tls_generator
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_linux_amd64 ./tools/tls_generator
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_linux_arm64 ./tools/tls_generator
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_darwin_amd64 ./tools/tls_generator
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_darwin_arm64 ./tools/tls_generator
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -o ./releases/tls_generator_windows_amd64.exe ./tools/tls_generator

mitm:
go vet ./tools/mitm
go build -ldflags "-s -w" -o ./releases/mitm ./tools/mitm
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,9 @@ curl "http://127.0.0.1:8090/job/rerun" -X POST -d '{"spider_name": "test-must-ok

You can directly use https://lizongying.github.io/go-crawler/.

If you want to view the demo, please trust the certificate.
[ca](./static/tls/ca.crt)

develop

```shell
Expand Down Expand Up @@ -1075,14 +1078,8 @@ Run
import "github.com/lizongying/go-crawler/pkg"
func (s *Spider) Stop(ctx context.Context) (err error) {
if err = s.Spider.Stop(ctx); err != nil {
s.logger.Error(err)
return
}
func (s *Spider) Stop(_ pkg.Context) (err error) {
err = pkg.DontStopErr
s.logger.Error(err)
return
}
Expand Down Expand Up @@ -1114,6 +1111,11 @@ Run
on the individual style of the user.
If there's a need for specific error handling, then regular methods like `YieldRequest` should be used.

* Other

* Upgrade go-crawl
* Clean up cache

## Example

example_spider.go
Expand Down
36 changes: 19 additions & 17 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,9 @@ curl "http://127.0.0.1:8090/job/rerun" -X POST -d '{"spider_name": "test-must-ok

你可以直接使用https://lizongying.github.io/go-crawler/

如果查看demo,请信任证书
[ca](./static/tls/ca.crt)

开发

```shell
Expand Down Expand Up @@ -931,6 +934,18 @@ make web_server

`Stop`方法中返回`pkg.DontStopErr`即可

```go
package main
import "github.com/lizongying/go-crawler/pkg"
func (s *Spider) Stop(_ pkg.Context) (err error) {
err = pkg.DontStopErr
return
}
```

* 任务队列使用`request``extra`还是`unique_key`?

首先说明的是,这三个词都是本框架中的概念:
Expand All @@ -952,24 +967,11 @@ make web_server
`Must[method]`更加简洁,但可能对于排查错误不太方便。是不是用,需要看使用者的个人风格。
如果需要特殊处理err,就需要使用普通的方法了,如`YieldRequest`

```go
package main
import "github.com/lizongying/go-crawler/pkg"
func (s *Spider) Stop(ctx context.Context) (err error) {
if err = s.Spider.Stop(ctx); err != nil {
s.logger.Error(err)
return
}
err = pkg.DontStopErr
s.logger.Error(err)
return
}
```
* 其他

* 升级go-crawl
* 清理缓存

## 示例

example_spider.go
Expand Down
3 changes: 3 additions & 0 deletions docs/content/en/docs/admin/ui/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ title: UI

You can directly use https://lizongying.github.io/go-crawler/.

If you want to view the demo, please trust the certificate.
[ca](https://github.com/lizongying/go-crawler/blob/main/static/tls/ca.crt)

develop

```shell
Expand Down
15 changes: 7 additions & 8 deletions docs/content/en/docs/usage/question/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,8 @@ title: Q & A
import "github.com/lizongying/go-crawler/pkg"
func (s *Spider) Stop(ctx context.Context) (err error) {
if err = s.Spider.Stop(ctx); err != nil {
s.logger.Error(err)
return
}
func (s *Spider) Stop(_ pkg.Context) (err error) {
err = pkg.DontStopErr
s.logger.Error(err)
return
}
Expand Down Expand Up @@ -100,4 +94,9 @@ title: Q & A

`Must[method]` is more concise, but it might be less convenient for troubleshooting errors. Whether to use it depends
on the individual style of the user.
If there's a need for specific error handling, then regular methods like `YieldRequest` should be used.
If there's a need for specific error handling, then regular methods like `YieldRequest` should be used.
* Other
* Upgrade go-crawl
* Clean up cache
2 changes: 2 additions & 0 deletions docs/content/zh/docs/admin/ui/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ title: 界面

你可以直接使用https://lizongying.github.io/go-crawler/

[ca](https://github.com/lizongying/go-crawler/blob/main/static/tls/ca.crt)

开发

```shell
Expand Down
33 changes: 16 additions & 17 deletions docs/content/zh/docs/usage/question/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ title: 问答

`Stop`方法中返回`pkg.DontStopErr`即可

```go
package main
import "github.com/lizongying/go-crawler/pkg"
func (s *Spider) Stop(_ pkg.Context) (err error) {
err = pkg.DontStopErr
return
}
```

* 任务队列使用`request``extra`还是`unique_key`?

首先说明的是,这三个词都是本框架中的概念:
Expand All @@ -74,20 +86,7 @@ title: 问答
`Must[method]`更加简洁,但可能对于排查错误不太方便。是不是用,需要看使用者的个人风格。
如果需要特殊处理err,就需要使用普通的方法了,如`YieldRequest`

```go
package main
import "github.com/lizongying/go-crawler/pkg"
func (s *Spider) Stop(ctx context.Context) (err error) {
if err = s.Spider.Stop(ctx); err != nil {
s.logger.Error(err)
return
}
err = pkg.DontStopErr
s.logger.Error(err)
return
}
```
* 其他

* 升级go-crawl
* 清理缓存

0 comments on commit 843e0c5

Please sign in to comment.