forked from 3394772548/yue-spider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
executable file
·72 lines (68 loc) · 1.98 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"./docs"
"flag"
"github.com/gin-gonic/gin"
"github.com/swaggo/files"
"github.com/swaggo/gin-swagger"
"log"
"os"
)
var (
h bool
port string
accessKey string
proxyUrl string
)
func init() {
flag.BoolVar(&h, "h", false, "this help")
flag.StringVar(&port, "port", "8080", "set http port")
flag.StringVar(&accessKey, "accessKey", "", "set accessKey")
flag.StringVar(&proxyUrl, "proxy", "", "set proxy")
}
// @title yue-spider API
// @version 1.0
// @description 淘宝App 闲鱼App api模拟调用,个人测试项目
// @contact.name API Support
// @contact.url
// @host
// @BasePath /
func main() {
flag.Parse()
if h {
flag.Usage()
os.Exit(0)
}
docs.SwaggerInfo.Title = "yue-spider"
gin.SetMode(gin.ReleaseMode)
r := gin.New()
r.Static("/docs", "./docs")
url := ginSwagger.URL("/docs/swagger.json") // The url pointing to API definition
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
//r.GET("/set.proxy.url",SetProxyUrl)
//宝贝基本信息
r.GET("/mtop.taobao.detail.getdetail", MtopTaobaoDetailGetDetail)
//宝贝详情
r.GET("/mtop.taobao.detail.getdesc", MtopTaobaoDetailGetdesc)
//宝贝评价
r.GET("/mtop.taobao.rate.detaillist.get", MtopTaobaoRateDetaillistGet)
//淘宝搜索
r.GET("/mtop.taobao.wsearch.appsearch", MtopTaobaoWsearchAppsearch)
//淘宝店铺搜索
r.GET("/mtop.taobao.wsearch.appsearch.shop", MtopTaobaoWsearchAppsearchShop)
//淘宝买家秀
r.GET("/mtop.taobao.ugc.tql.facade", MtopTaobaoUgcTqlFacade)
//闲鱼搜索
r.GET("/mtop.taobao.idle.main.item.search", MtopTaobaoIdleMainItemSearch)
//闲鱼宝贝基本信息
r.GET("/mtop.taobao.idle.item.detail", MtopTaobaoIdleItemDetail)
//闲鱼评论
//
//淘口令解析
r.GET("/mtop.taobao.sharepassword.querypassword", MtopTaobaoSharepasswordQuerypassword)
log.Println("爬虫系统已启动.API接口文档地址: http://localhost:" + port + "/swagger/index.html")
err := r.Run(":" + port)
if err != nil {
log.Println(err)
}
}