MCPcopy Index your code
hub / github.com/TruthHun/BookStack / Crawl

Method Crawl

controllers/BaseController.go:534–553  ·  view source on GitHub ↗

内容采集

()

Source from the content-addressed store, hash-verified

532
533// 内容采集
534func (this *BaseController) Crawl() {
535 if this.Member.MemberId > 0 {
536 if val, ok := this.GetSession("crawl").(string); ok && val == "1" {
537 this.JsonResult(1, "您提交的上一次采集未完成,请稍后再提交新的内容采集")
538 }
539 this.SetSession("crawl", "1")
540 defer this.DelSession("crawl")
541 urlStr := this.GetString("url")
542 force, _ := this.GetBool("force") //是否是强力采集,强力采集,使用Chrome
543 intelligence, _ := this.GetInt("intelligence") //是否是强力采集,强力采集,使用Chrome
544 contType, _ := this.GetInt("type")
545 diySel := this.GetString("diy")
546 content, err := utils.CrawlHtml2Markdown(urlStr, contType, force, intelligence, diySel, []string{}, nil)
547 if err != nil {
548 this.JsonResult(1, "采集失败:"+err.Error())
549 }
550 this.JsonResult(0, "采集成功", content)
551 }
552 this.JsonResult(1, "请先登录再操作")
553}
554
555// 关注或取消关注
556func (this *BaseController) SetFollow() {

Callers

nothing calls this directly

Calls 2

JsonResultMethod · 0.95
CrawlHtml2MarkdownFunction · 0.92

Tested by

no test coverage detected