Skip to content

Commit

Permalink
修改文档
Browse files Browse the repository at this point in the history
  • Loading branch information
linabellbiu committed Feb 9, 2023
1 parent 2eacffe commit c4e7132
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 3 deletions.
80 changes: 79 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,86 @@
# sms-auto-regist (coding...)
# sms-auto-regist
## 爬取虚拟手机号的短信验证码,从而登录需要手机号验证码注册的网站,可以刷阅读,刷赞,刷关注之类的操作
#### 云接码
<h>


### How to use

#### reference

run

```go
// sms-auto-regist\example\main.go

// initialization
collect.NewCollect(
collect.SetConfigPath("../config.yml"),
)

// start app
app.Run(&app.Example{})

// Start the crawler scheduled task
job(
www_yunjiema_top.NewCollect(conf.Global.CollectSourceHtml.WwwYunjiemaTop),
)
```

receive
```go
for {
select {
case tel := <-collect.SendFindTel:
fmt.Printf("Find the crawled mobile phone number %s:\n", tel)
case tel := <-collect.SendFindSMSTel:
fmt.Printf("Find the phone number that sent the text message%s:\n", tel)
}
}
```


### Customize crawling SMS website

#### mplement the interface
```go
// sms-auto-regist\collect\collect.go
type Job interface
```

#### reference
```go
// sms-auto-regist\collect\origin\www_yunjiema_top\html.go
type Collect struct {
config conf.DefaultCollectConfig
}

func NewCollect(config conf.DefaultCollectConfig) *Collect {
return &Collect{
config: config,
}
}

func (c *Collect) Run() {
...
}

func (c *Collect) GetConfig() conf.DefaultCollectConfig {
return c.config
}
```

#### tools
```go
// Send the crawled mobile phone number to the pipeline
collect.WriteFindTel(tel)

// Send the SMS received by crawling the mobile phone number to the pipeline
collect.WriteFindSMSTel(*collect.FindSMSTel)
```


### Result
#### 接收到的虚拟短信

<image src="https://user-images.githubusercontent.com/20228139/200343258-7c6696c1-79c6-4b31-99dd-5f85b8e8bb91.png" width=60% height=40%>
Expand Down
4 changes: 2 additions & 2 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/linabellbiu/sms-auto-regist/collect"
"github.com/linabellbiu/sms-auto-regist/collect/origin/www_yunjiema_top"
"github.com/linabellbiu/sms-auto-regist/conf"
app2 "github.com/linabellbiu/sms-auto-regist/example/app"
"github.com/linabellbiu/sms-auto-regist/example/app"
"github.com/robfig/cron"
"log"
"os"
Expand All @@ -20,7 +20,7 @@ func main() {
)

// 启动应用
app2.Run(&app2.Example{})
app.Run(&app.Example{})

// 启动爬虫定时任务
job(
Expand Down

0 comments on commit c4e7132

Please sign in to comment.