tianyancha

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OriginUrl = "https://www.tianyancha.com/"

	TaskNameTianYanCha = "tian_yan_cha"
)

Variables

View Source
var TianYanChaTask = &fetcher.Task{
	Property: fetcher.Property{
		Name:     TaskNameTianYanCha,
		WaitTime: 1 * time.Second,
		MaxDepth: 5,
		Cookie:   "xxx",
		Headers: map[string]string{
			"X-AUTH-TOKEN": "xxx",
			"X-TYCID":      "xxx",
		},
	},

	Rule: fetcher.RuleTree{
		Root: func() ([]*fetcher.Request, error) {
			roots := []*fetcher.Request{
				&fetcher.Request{
					Priority: 0,
					Url:      OriginUrl,
					Method:   "GET",
					RuleName: ruleNameIndustry,
				},
			}
			return roots, nil
		},
		Trunk: map[string]*fetcher.Rule{
			ruleNameIndustry:      &fetcher.Rule{ParseFunc: ParseHomeURL},
			ruleNameCompanyList:   &fetcher.Rule{ParseFunc: ParseCompanyList},
			ruleNameCompanyDetail: &fetcher.Rule{ParseFunc: ParseCompanyDetail},
		},
	},
}

Functions

func ParseCompanyDetail

func ParseCompanyDetail(ctx *fetcher.Context) (fetcher.ParseResult, error)

ParseCompanyDetail parses the company detail info

func ParseCompanyList

func ParseCompanyList(ctx *fetcher.Context) (fetcher.ParseResult, error)

ParseCompanyList parses the company list

func ParseHomeURL

func ParseHomeURL(ctx *fetcher.Context) (fetcher.ParseResult, error)

ParseHomeURL parses the homepage of the TianYanCha

Types

type Data

type Data struct {
	ID                uint   `json:"id" gorm:"primarykey;autoIncrement"`
	IndustryName      string `json:"industry_name" gorm:"column:industry_name"`
	CompanyName       string `json:"company_name" gorm:"column:company_name"`
	CompanyId         string `json:"company_id" gorm:"column:company_id"`
	CompanyType       string `json:"company_type" gorm:"column:company_type"`
	CreditCode        string `json:"credit_code" gorm:"column:credit_code"`
	Score             string `json:"score" gorm:"column:score"`
	KeyPeople         string `json:"key_people" gorm:"column:key_people"`
	Shareholder       string `json:"shareholder" gorm:"column:shareholder"`
	ForeignInvestment string `json:"foreign_investment" gorm:"column:foreign_investment"`
}

func (Data) TableName

func (d Data) TableName() string

Jump to

Keyboard shortcuts

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