Files
spider/cmd/theimpression.go
toom1996 fde57984e7 update
2026-09-20 00:44:47 +08:00

35 lines
903 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cmd
import (
"github.com/spf13/cobra"
"my-spiders/internal/spider"
)
var (
theImpressionMaxCo int
theImpressionMaxArticles int
)
var theImpressionCmd = &cobra.Command{
Use: "theimpression",
Short: "启动 The Impression 街拍采集器 (street-style)",
Run: func(cmd *cobra.Command, args []string) {
if theImpressionMaxCo <= 0 {
theImpressionMaxCo = 5
}
// 复用全局 -d/--debug 标志
isDebug := debug
s := spider.NewTheImpressionSpider(theImpressionMaxCo, IngestClient)
s.MaxArticles = theImpressionMaxArticles
s.Debug = isDebug
s.Run()
},
}
func init() {
rootCmd.AddCommand(theImpressionCmd)
theImpressionCmd.Flags().IntVarP(&theImpressionMaxCo, "max-co", "m", 5, "最大并发数限制")
theImpressionCmd.Flags().IntVarP(&theImpressionMaxArticles, "max-articles", "n", 0, "最多抓取的街拍任务数(0=不限制,小批量试抓用)")
}