内容采集
()
| 532 | |
| 533 | // 内容采集 |
| 534 | func (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 | // 关注或取消关注 |
| 556 | func (this *BaseController) SetFollow() { |
nothing calls this directly
no test coverage detected