119 lines
2.6 KiB
Go
119 lines
2.6 KiB
Go
package publisher
|
||
|
||
import (
|
||
"context"
|
||
"geo/internal/config"
|
||
"log"
|
||
)
|
||
|
||
type PublisherInerface interface {
|
||
PublishNote() (bool, string)
|
||
WaitLogin() (bool, string)
|
||
}
|
||
|
||
type NewPublisher func(
|
||
ctx context.Context,
|
||
param *TaskParams,
|
||
cfg *config.Config,
|
||
logger *log.Logger) PublisherInerface
|
||
|
||
type PublisherValue struct {
|
||
Name string
|
||
InitMethod NewPublisher
|
||
ContentFormat string //需要的文章格式,html,text,markdown
|
||
ImgNeed int8 //是否需要图片,1需要,2非必须,3不要
|
||
Type int8 //类型:1文章2视频
|
||
WordContainImg bool //文章带上头图
|
||
}
|
||
|
||
var PublisherMap = map[string]*PublisherValue{
|
||
"xhs": {
|
||
Name: "小红书",
|
||
InitMethod: NewXiaohongshuPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 3,
|
||
Type: 1,
|
||
WordContainImg: true,
|
||
},
|
||
"bjh": {
|
||
Name: "百家号",
|
||
InitMethod: NewBaijiahaoPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: true,
|
||
},
|
||
"toutiao": {
|
||
Name: "今日头条",
|
||
InitMethod: NewToutiaoPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: true,
|
||
},
|
||
"wyh": {
|
||
Name: "网易号",
|
||
InitMethod: NewWangyiPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: true,
|
||
},
|
||
"shh": {
|
||
Name: "搜狐号",
|
||
InitMethod: NewSohuPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: false,
|
||
},
|
||
"zh": {
|
||
Name: "知乎",
|
||
InitMethod: NewZhihuPublisher,
|
||
ContentFormat: "text",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: true,
|
||
},
|
||
"js": {
|
||
Name: "简书",
|
||
InitMethod: NewJianshuPublisher,
|
||
ContentFormat: "markdown",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: false,
|
||
},
|
||
"dysp": {
|
||
Name: "抖音视频",
|
||
InitMethod: NewDouyinSpPublisher,
|
||
ContentFormat: "video",
|
||
ImgNeed: 1,
|
||
Type: 2,
|
||
WordContainImg: false,
|
||
},
|
||
"xhssp": {
|
||
Name: "小红书视频",
|
||
InitMethod: NewXiaohongshuVideoPublisher,
|
||
ContentFormat: "video",
|
||
ImgNeed: 1,
|
||
Type: 2,
|
||
WordContainImg: false,
|
||
},
|
||
"sphsp": {
|
||
Name: "视频号视频",
|
||
InitMethod: NewShipinhaoVideoPublisher,
|
||
ContentFormat: "video",
|
||
ImgNeed: 1,
|
||
Type: 2,
|
||
WordContainImg: false,
|
||
},
|
||
"csdn": {
|
||
Name: "CSDN",
|
||
InitMethod: NewCSDNPublisher,
|
||
ContentFormat: "markdown",
|
||
ImgNeed: 1,
|
||
Type: 1,
|
||
WordContainImg: false,
|
||
},
|
||
}
|