go colly 爬虫博客到wordpress
https://www.aispider.cc
25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
537 B
23 lines
537 B
package spider
|
|
|
|
import (
|
|
"go-wordpress-xmlrpc/wordpress"
|
|
"log"
|
|
)
|
|
|
|
func saveBlog(title string, content string, postDate string, tags []string, catelogs []string) {
|
|
c, err := NewClient(`http://49.235.160.131/xmlrpc.php`, UserInfo{
|
|
//c, err := NewClient(`https://www.aispider.cc/xmlrpc.php`, UserInfo{
|
|
`你的账户`,
|
|
`你的密码`,
|
|
})
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
p := wordpress.NewPost(title, content, postDate, tags, catelogs)
|
|
blogID, err := c.Call(p)
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
log.Println(blogID)
|
|
}
|
|
|