nga

package
v0.0.0-...-4b5aacb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	THREAD_COUNT              = 2
	GET_IP_LOCATION           = false //	获取ip地址
	ENHANCE_ORI_REPLY         = false //	功能见 #35
	PAGE_DOWNLOAD_LIMIT       = 100   //	限制单次下载的页数 #56
	USE_TITLE_AS_FOLDER_NAME  = false
	USE_TITLE_AS_MD_FILE_NAME = false
	USE_LOCAL_SMILE_PIC       = false       // 使用本地表情 #58
	LOCAL_SMILE_PIC_PATH      = "../smile/" //本地表情路径 #58

)

这里是配置文件可以改的

View Source
var (
	VERSION  = "1.5.2"      //需要手动改
	BUILD_TS = "1691664141" //无需,GitHub actions会自动填写
	GIT_REF  = ""           //无需,GitHub actions会自动填写
	GIT_HASH = ""           //无需,GitHub actions会自动填写
	DELAY_MS = 330
)

这里配置文件和传参都没法改

View Source
var BASE_URL string
View Source
var COOKIE string
View Source
var (
	DEBUG_MODE = "1" //GitHub Actions 打包的时候会修改为"0"。本地打包可以 go build -ldflags "-X 'github.com/ludoux/ngapost2md/nga.DEBUG_MODE=0'" main.go

)

ldflags 区域。GitHub Actions 编译时会使用 ldflags 来修改如下值:

Functions

func FindFolderNameByTid

func FindFolderNameByTid(tid int) string

找不到时会直接返回 ""

func ToSaveFilename

func ToSaveFilename(in string) string

Types

type Floor

type Floor struct {
	Lou        int
	Pid        int
	Timestamp  int64
	Username   string
	IpLocation string
	UserId     int
	Content    string
	LikeNum    int
	AppendPid  []int
	Comments   Floors
}

type Floors

type Floors []Floor

type NgaClient

type NgaClient struct {
	*req.Client
	// contains filtered or unexported fields
}
var Client *NgaClient

func NewNgaClient

func NewNgaClient() *NgaClient

type Tiezi

type Tiezi struct {
	Tid             int
	Title           string
	TitleFolderSafe string
	Catelogy        string
	Username        string
	UserId          int
	WebMaxPage      int
	LocalMaxPage    int
	LocalMaxFloor   int
	FloorCount      int    //包含主楼
	Floors          Floors //主楼为[0]
	HotPosts        Floors
	Timestamp       int64  //page() fixFloorContent()  中会更新
	Version         string //这个是软件的version
	Assets          map[string]string
}

func (*Tiezi) Download

func (tiezi *Tiezi) Download()

func (*Tiezi) GetNeededFolderName

func (tiezi *Tiezi) GetNeededFolderName() string

会首先调用FindFolderNameByTid,确定本地没有相关文件夹再返回指定格式文件名。否则返回本地已有文件名

func (*Tiezi) InitFromLocal

func (tiezi *Tiezi) InitFromLocal(tid int)

*

  • @description: 本地已经有生成过,现在来根据local信息来追加下载新楼层。
  • @param {int} tid 帖子tid
  • @return {*}

func (*Tiezi) InitFromWeb

func (tiezi *Tiezi) InitFromWeb(tid int)

*

  • @description: 本地未生成过。初始化主楼和第一页
  • @param {int} tid 帖子tid
  • @return {*}

func (*Tiezi) SaveAssetsMap

func (tiezi *Tiezi) SaveAssetsMap()

func (*Tiezi) SaveProcessInfo

func (tiezi *Tiezi) SaveProcessInfo()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL