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"` ForeignInvestment string `json:"foreign_investment" gorm:"column:foreign_investment"` }
Click to show internal directories.
Click to hide internal directories.