Documentation ¶
Index ¶
- Constants
- Variables
- func RegistSite(name string, s Spider)
- type Chouti
- type ChoutiList
- type Github
- type Guanggu
- type Hacker
- type Hot
- type Link
- type Page
- type Reddit
- type RedditList
- type Site
- type SiteTab
- type Spider
- type Tieba
- type V2ex
- type WbVideoList
- type Wbvideo
- type Weibo
- type Zaobao
- type Zhihu
Constants ¶
View Source
const ( // 抓取类型 CrawApi = 1 CrawHtml = 2 // 渲染的样式 CardText = 0 CardRichText = 1 CardVideo = 2 )
View Source
const SITE_CT = "chouti"
View Source
const SITE_GITHUB = "github"
View Source
const SITE_GUANGGU = "guanggu"
View Source
const SITE_HACKER = "hacker"
View Source
const SITE_REDDIT = "reddit"
View Source
const SITE_TIEBA = "tieba"
View Source
const SITE_V2EX = "v2ex"
View Source
const SITE_WBVIDEO = "wbvideo"
View Source
const SITE_WEIBO = "weibo"
View Source
const SITE_ZAOBAO = "zaobao"
View Source
const SITE_ZHIHU = "zhihu"
Variables ¶
View Source
var ( // 网站配置 SiteMap = make(map[string]Spider) // 可用网站 Avaiable = []string{ SITE_V2EX, SITE_CT, SITE_ZHIHU, SITE_WEIBO, SITE_WBVIDEO, SITE_GUANGGU, SITE_HACKER, SITE_GITHUB, SITE_TIEBA, SITE_REDDIT, SITE_ZAOBAO, } )
View Source
var ChoutiTabs = []SiteTab{
{
Url: "/link/hot",
Tag: "hot",
Name: "新热榜",
},
{
Url: "/top/24hr",
Tag: "24hr",
Name: "24小时最热",
},
{
Url: "/top/72hr",
Tag: "72hr",
Name: "3天最热",
},
}
View Source
var GithubTabs = []SiteTab{
{
Tag: "trending",
Url: "https://github.com/trending",
Name: "Trending",
},
{
Tag: "trending-php",
Url: "https://github.com/trending/php?since=daily",
Name: "Trending-PHP",
},
{
Tag: "trending-go",
Url: "https://github.com/trending/go?since=daily",
Name: "Trending-Go",
},
}
View Source
var GuangGuTabs = []SiteTab{
{
Tag: "default",
Name: "默认",
Url: "https://www.guozaoke.com/",
},
{
Tag: "latest",
Name: "最新",
Url: "https://www.guozaoke.com/?tab=latest",
},
}
View Source
var HackerTabs = []SiteTab{
{
Tag: "new",
Name: "最新",
Url: "https://news.ycombinator.com/",
},
{
Tag: "show",
Name: "作品展示",
Url: "https://news.ycombinator.com/shownew",
},
}
View Source
var RedditTabs = []SiteTab{
{
Tag: "AskReddit",
Name: "AskReddit",
Url: "AskReddit",
},
{
Tag: "Jokes",
Name: "Jokes",
Url: "Jokes",
},
{
Tag: "leagueoflegends",
Name: "lol",
Url: "leagueoflegends",
},
}
View Source
var TiebaTabs = []SiteTab{
{
Tag: "beiguo",
Name: "抗压背锅吧",
Url: "https://tieba.baidu.com/f?ie=utf-8&kw=抗压背锅&fr=search",
},
{
Tag: "ruozhi",
Name: "弱智吧",
Url: "https://tieba.baidu.com/f?ie=utf-8&kw=弱智&fr=search",
},
}
View Source
var V2exTabs = []SiteTab{
{
Tag: "all",
Name: "全部",
},
{
Tag: "hot",
Name: "最热",
},
}
View Source
var WbvideoTabs = []SiteTab{ { Tag: "all", Url: "https://weibo.com/tv/api/component?page=%2Ftv%2Fbillboard", Name: "全站", Args: map[string]string{ "cid": "4418213501411061", }, }, { Tag: "funny", Url: "https://weibo.com/tv/api/component?page=%2Ftv%2Fbillboard%2F4418219809678869", Name: "搞笑幽默", Args: map[string]string{ "cid": "4418219809678869", }, }, }
View Source
var WeiboTabs = []SiteTab{
{
Tag: "hot",
Url: "https://s.weibo.com/top/summary?cate=realtimehot",
Name: "热搜",
},
}
View Source
var ZaobaoTabs = []SiteTab{
{
Tag: "focus",
Url: "http://www.zaobao.com/",
Name: "今日焦点",
},
}
View Source
var ZhihuTabs = []SiteTab{
{
Tag: "all",
Url: "https://www.zhihu.com/hot",
Name: "知乎热榜",
},
}
Functions ¶
func RegistSite ¶
Types ¶
type ChoutiList ¶
type Guanggu ¶
type Guanggu struct {
Site
}
func NewGuanggu ¶
func NewGuanggu() *Guanggu
type Hot ¶
type Hot struct { Key string `json:"key"` Title string `json:"title"` Desc string `json:"desc"` Rank float64 `json:"rank"` OriginUrl string `json:"origin_url"` Card uint8 `json:"card_type"` Ext map[string]string `json:"ext"` }
热榜
type Page ¶
type Page struct { Link Link Content string Doc *goquery.Document Json []map[string]interface{} List []Hot T time.Time }
抓取的页面信息
type RedditList ¶
type WbVideoList ¶
type WbVideoList struct { Code string `json:"code"` Msg string `json:"msg"` Data struct { Videos struct { Next int `json:"next_cursor"` List []struct { Title string `json:"title"` Cover string `json:"cover_image"` Id int64 `json:"mid"` Oid string `json:"oid"` Date string `json:"date"` PlayCount string `json:"play_count"` } `json:"list"` } `json:"Component_Billboard_Billboardlist"` } `json:"data"` }
type Wbvideo ¶
type Wbvideo struct {
Site
}
func NewWbvideo ¶
func NewWbvideo() *Wbvideo
Click to show internal directories.
Click to hide internal directories.