Documentation
¶
Index ¶
- Constants
- func AttrCompare(targetAttr html.Attribute, token *html.Token) bool
- func AttrsCompare(targetAttrs []html.Attribute, token *html.Token) bool
- func GetAttr(attrKey string, attrs []html.Attribute) string
- func GetContext(node *TokenObjSub) string
- func GetWebPackage(url string) (map[string][]string, []byte, error)
- func HtmlLoop(tokenizer *html.Tokenizer, filter map[types.TokenTypeName][]*FilterObj)
- func HtmlLoopFilter(body io.Reader, selfClosingTagToken []string, ...)
- func HtmlLoopFilterDefaultClose(body io.Reader, filterMap map[types.TokenTypeName][]*FilterObjnewSub, ...)
- func HtmlLoopFilterOne(tokenizer *html.Tokenizer, filterMap map[types.TokenTypeName][]*FilterObj)
- func HtmlLoopFilterUnFix(body io.Reader, selfClosingTagToken []string, ...)
- func IsTextEnd(text string) bool
- func LoadHttpRespont(resp *http.Response) (map[string][]string, []byte, error)
- func SetDefaultClient()
- type FilterObj
- type FilterObjnewSub
- type FindOption
- type HtmlLoopTool
- type HtmlTree
- type TokenObjSub
- type WebInfo
Constants ¶
View Source
const ( FilterOperation_GetContent int = 1 // 取得目標標籤內文 FilterOperation_GetSubToken int = 2 // 取得目標標籤內的子標籤 FilterOperation_GetSubcContent int = 3 // 取得目標標籤內的子內文 )
Filter Operation
Variables ¶
This section is empty.
Functions ¶
func AttrCompare ¶
目標 attr 是否存在 token 內
func AttrsCompare ¶
目標 attrs 是否全部都在目標內
func GetAttr ¶
取得節點附加參數
@params attrKey 附加參數關鍵字
@params []html.Attribute 附加參數列表
@return string 附加參數資料, PS: 預設為空字串
func GetContext ¶
func GetContext(node *TokenObjSub) string
取得所有子物件內文
@params *TokenObjSub 起始解點
@return string 內文
func GetWebPackage ¶
取得網頁 @parame string 網址 @retrun map[string]string Http Header @return []byte Http Body @return error 錯誤回傳
func HtmlLoop ¶
func HtmlLoop(tokenizer *html.Tokenizer, filter map[types.TokenTypeName][]*FilterObj)
func HtmlLoopFilter ¶
func HtmlLoopFilter(body io.Reader, selfClosingTagToken []string, filterMap map[types.TokenTypeName][]*FilterObjnewSub, pageFix func(nodeDepth int, next, current, previous **TokenObjSub) (int, bool))
func HtmlLoopFilterDefaultClose ¶
func HtmlLoopFilterDefaultClose(body io.Reader, filterMap map[types.TokenTypeName][]*FilterObjnewSub, pageFix func(nodeDepth int, next, current, previous **TokenObjSub) (int, bool))
func HtmlLoopFilterOne ¶
func HtmlLoopFilterOne(tokenizer *html.Tokenizer, filterMap map[types.TokenTypeName][]*FilterObj)
func HtmlLoopFilterUnFix ¶
func HtmlLoopFilterUnFix(body io.Reader, selfClosingTagToken []string, filterMap map[types.TokenTypeName][]*FilterObjnewSub)
func LoadHttpRespont ¶
func SetDefaultClient ¶
func SetDefaultClient()
Types ¶
type FilterObjnewSub ¶
type FilterObjnewSub struct { FiltAttrs []html.Attribute // 標籤篩選條件 Res []*TokenObjSub // 標籤結構 Operation []int // 控制選項 暫時用數字處理 }
取得符合的底下所有仔物件
type HtmlLoopTool ¶
type HtmlLoopTool struct {
SelfClosingTagToken []string
}
func (HtmlLoopTool) HtmlLoopFilterLevelSub ¶
func (self HtmlLoopTool) HtmlLoopFilterLevelSub(tokenizer *html.Tokenizer, filterMap map[types.TokenTypeName][]*FilterObjnewSub, pageFix func(nodeDepth int, next, current, previous **TokenObjSub) (int, bool))
建立全物件索引, 並索引符合條件的物件
@params *html.Tokenizer 頁面資料
@params map[types.TokenTypeName][]*FilterObjnewSub 塞選器物件
@params func(nodeDepth int, next, current, previous **TokenObjSub) (int, bool) 頁面修正方法
type TokenObjSub ¶
type TokenObjSub struct { NodeDepth int NodeId int Previous *TokenObjSub // 前一個 Res *html.Token // 當前 SubRes []*TokenObjSub // 子標籤結構 }
Click to show internal directories.
Click to hide internal directories.