添加图片接口
This commit is contained in:
parent
cbad28f7c6
commit
5335ef3cc2
72
image/image.go
Normal file
72
image/image.go
Normal file
|
@ -0,0 +1,72 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
crontab "474420502.top/eson/crontabex"
|
||||
"474420502.top/eson/imitater"
|
||||
"474420502.top/test/logdb"
|
||||
)
|
||||
|
||||
func main() {
|
||||
imitater.Register("toutiao", &TaskEx{})
|
||||
person := imitater.NewPerson()
|
||||
person.Config("task.yaml")
|
||||
person.Execute()
|
||||
}
|
||||
|
||||
// TaskEx 任务相关类
|
||||
type TaskEx struct {
|
||||
imitater.Task
|
||||
db *logdb.LogDB
|
||||
}
|
||||
|
||||
// Init 初始化函数
|
||||
func (te *TaskEx) Init() {
|
||||
te.db = logdb.New("../logdb.yaml")
|
||||
}
|
||||
|
||||
// Execute 执行过程的方法
|
||||
func (te *TaskEx) Execute(glocal map[string]interface{}) imitater.ITask {
|
||||
|
||||
resp, err := te.Request()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return te
|
||||
}
|
||||
|
||||
var adDataList []string
|
||||
|
||||
if gjson.Valid(resp.Content()) {
|
||||
P := gjson.Parse(resp.Content())
|
||||
data := P.Get(`data`)
|
||||
if data.Exists() {
|
||||
adData := data.Get(`ordered_info.#.ad_data`)
|
||||
if adData.Exists() {
|
||||
for _, result := range adData.Array() {
|
||||
adDataList = append(adDataList, result.String())
|
||||
}
|
||||
}
|
||||
|
||||
relatedVideo := data.Get(`related_video_toutiao.#[show_tag = "广告"]#`)
|
||||
if adData.Exists() {
|
||||
for _, result := range relatedVideo.Array() {
|
||||
adDataList = append(adDataList, result.String())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
log.Println("be careful:", resp.Content())
|
||||
}
|
||||
|
||||
if imitater.ADDataSave(te, te.db, adDataList) {
|
||||
te.GetCrontab().SetStatus(crontab.SExecuteOK, true)
|
||||
} else {
|
||||
te.GetCrontab().SetStatus(crontab.SExecuteOK, false)
|
||||
}
|
||||
|
||||
return te
|
||||
}
|
|
@ -1 +1 @@
|
|||
curl 'http://is.snssdk.com/2/article/information/v25/?latitude=23.060406&longitude=113.380702&group_id=6636256062225777160&item_id=6636256062225777160&aggr_type=1&context=1&from_category=%E7%BB%84%E5%9B%BE&article_page=2&search_id=&query=&is_low_actived=0&iid=54363182959&device_id=55149394150&ac=wifi&channel=xiaomi&aid=13&app_name=news_article&version_code=703&version_name=7.0.3&device_platform=android&ab_version=664543%2C659641%2C640301%2C486952%2C654085%2C651369%2C662176%2C472113%2C292723%2C664015%2C571131%2C616214%2C665141%2C639002%2C239095%2C612191%2C641905%2C170988%2C643891%2C631016%2C659018%2C374117%2C652002%2C600231%2C664393%2C587817%2C655402%2C649422%2C633720%2C613176%2C550042%2C603542%2C659212%2C627550%2C663332%2C659530%2C649427%2C614100%2C522765%2C659286%2C416055%2C621360%2C651696%2C661405%2C558140%2C555254%2C640008%2C471406%2C603440%2C596392%2C660510%2C630576%2C598626%2C644857%2C646252%2C603379%2C603401%2C603404%2C603405%2C638928%2C662915%2C659552%2C646564%2C648850%2C656461%2C657631%2C661899%2C662644%2C629152%2C607361%2C567866%2C609337%2C662818%2C652366%2C662099%2C641414%2C664191%2C654358%2C651920%2C662280%2C655010%2C650887%2C622716%2C662145%2C622728%2C653957%2C659453%2C665452%2C640997%2C641080%2C661616%2C660462%2C664030%2C662397%2C631594%2C653241%2C658364%2C554836%2C549647%2C644131%2C472442%2C31210%2C572465%2C651597%2C644058%2C615291%2C606547%2C442255%2C660075%2C648180%2C630218%2C546701%2C281298%2C658129%2C622045%2C325619%2C665473%2C625066%2C652952%2C665098%2C659705%2C664311%2C431142%2C498375%2C657352%2C638335%2C467513%2C644240%2C631638%2C665565%2C655235%2C595556%2C664318%2C664673%2C661444%2C661450%2C654129%2C655710%2C658938%2C660830%2C648316%2C640210%2C656557%2C644675%2C662684%2C661781%2C293032%2C457481%2C649402%2C591908%2C655988&ab_client=a1%2Cc4%2Ce1%2Cf1%2Cg2%2Cf7&ab_group=100167&ab_feature=94563%2C102749&abflag=3&ssmix=a&device_type=MI+8+SE&device_brand=Xiaomi&language=zh&os_api=27&os_version=8.1.0&uuid=99001141462873&openudid=58cccf5030e9cbd4&manifest_version_code=703&resolution=1080*2114&dpi=440&update_version_code=70315&_rticket=1545592651899&plugin=26958&pos=5r_-9Onkv6e_eCQieCoDeCUfv7G_8fLz-vTp6Pn4v6esrK6zrqWtqq2vsb_x_On06ej5-L-nr66zrautqa2rsb_88Pzt3vTp5L-nv3gkIngqA3glH7-xv_zw_O3R8vP69Ono-fi_p6ysrrOprailq6mxv_zw_O3R_On06ej5-L-nr66zraiqr66r4A%3D%3D&fp=zlT_L2UeLlPrFlPrPrU1FYwIJlm1&tma_jssdk_version=1.7.1.4&rom_version=miui_v10_v10.0.1.0.oebcnfh&ts=1545592651&as=a2950da1db843c1f3f4355&mas=00b3a3d12745a68d7285a73f411d8f9c89a6a2a24206686ea7' -H 'Host: is.snssdk.com' -H 'Proxy-Connection: keep-alive' -H 'Cookie: odin_tt=5bc108effff4529886a0aa36812c115d38b0e739f9abff2139107953c017cc62343bab05794f7fb3075b25846f32c178; UM_distinctid=1655625f84a18e-0897e6c8fc225e-6b55284e-4e4b0-1655625f84c3b; __tea_sdk__ssid=a79e00a6-b717-423f-9e97-f8ac84635f7e; tt_webid=6591877343492081160; __tea_sdk__user_unique_id=6591877343492081160; CNZZDATA1264530760=1269028608-1534945655-%7C1534945655; _ga=GA1.2.1032699944.1534947531; sid_guard=5ccb73ded741fb5f56e64623ca03ac8b%7C1544665500%7C5184000%7CMon%2C+11-Feb-2019+01%3A45%3A00+GMT; uid_tt=1f76f0742e12b4f8a5f32c009d5f7c52; sid_tt=5ccb73ded741fb5f56e64623ca03ac8b; sessionid=5ccb73ded741fb5f56e64623ca03ac8b; alert_coverage=77; install_id=54363182959; ttreq=1$05885f6b61aaffcd5e901e181629f2e1d2851d21; qh[360]=1' -H 'Accept-Encoding: gzip' -H 'X-SS-REQ-TICKET: 1545592651908' -H 'X-Tt-Token: 005ccb73ded741fb5f56e64623ca03ac8bdc236ae81584d4b02df898418e84e101852bddfc64ca324cdf12e2a5ea1d924039' -H 'sdk-version: 1' -H 'User-Agent: Dalvik/2.1.0 (Linux; U; Android 8.1.0; MI 8 SE MIUI/V10.0.1.0.OEBCNFH) NewsArticle/7.0.3 cronet/TTNetVersion:a729d5c3 2018-11-25' -H 'X-SS-TC: 0' --compressed
|
||||
curl --name 'tt-image' --task toutiao 'http://is.snssdk.com/2/article/information/v25/?latitude=23.060406&longitude=113.380702&group_id=6636256062225777160&item_id=6636256062225777160&aggr_type=1&context=1&from_category=%E7%BB%84%E5%9B%BE&article_page=2&search_id=&query=&is_low_actived=0&iid=54363182959&device_id=55149394150&ac=wifi&channel=xiaomi&aid=13&app_name=news_article&version_code=703&version_name=7.0.3&device_platform=android&ab_version=664543%2C659641%2C640301%2C486952%2C654085%2C651369%2C662176%2C472113%2C292723%2C664015%2C571131%2C616214%2C665141%2C639002%2C239095%2C612191%2C641905%2C170988%2C643891%2C631016%2C659018%2C374117%2C652002%2C600231%2C664393%2C587817%2C655402%2C649422%2C633720%2C613176%2C550042%2C603542%2C659212%2C627550%2C663332%2C659530%2C649427%2C614100%2C522765%2C659286%2C416055%2C621360%2C651696%2C661405%2C558140%2C555254%2C640008%2C471406%2C603440%2C596392%2C660510%2C630576%2C598626%2C644857%2C646252%2C603379%2C603401%2C603404%2C603405%2C638928%2C662915%2C659552%2C646564%2C648850%2C656461%2C657631%2C661899%2C662644%2C629152%2C607361%2C567866%2C609337%2C662818%2C652366%2C662099%2C641414%2C664191%2C654358%2C651920%2C662280%2C655010%2C650887%2C622716%2C662145%2C622728%2C653957%2C659453%2C665452%2C640997%2C641080%2C661616%2C660462%2C664030%2C662397%2C631594%2C653241%2C658364%2C554836%2C549647%2C644131%2C472442%2C31210%2C572465%2C651597%2C644058%2C615291%2C606547%2C442255%2C660075%2C648180%2C630218%2C546701%2C281298%2C658129%2C622045%2C325619%2C665473%2C625066%2C652952%2C665098%2C659705%2C664311%2C431142%2C498375%2C657352%2C638335%2C467513%2C644240%2C631638%2C665565%2C655235%2C595556%2C664318%2C664673%2C661444%2C661450%2C654129%2C655710%2C658938%2C660830%2C648316%2C640210%2C656557%2C644675%2C662684%2C661781%2C293032%2C457481%2C649402%2C591908%2C655988&ab_client=a1%2Cc4%2Ce1%2Cf1%2Cg2%2Cf7&ab_group=100167&ab_feature=94563%2C102749&abflag=3&ssmix=a&device_type=MI+8+SE&device_brand=Xiaomi&language=zh&os_api=27&os_version=8.1.0&uuid=99001141462873&openudid=58cccf5030e9cbd4&manifest_version_code=703&resolution=1080*2114&dpi=440&update_version_code=70315&_rticket=1545592651899&plugin=26958&pos=5r_-9Onkv6e_eCQieCoDeCUfv7G_8fLz-vTp6Pn4v6esrK6zrqWtqq2vsb_x_On06ej5-L-nr66zrautqa2rsb_88Pzt3vTp5L-nv3gkIngqA3glH7-xv_zw_O3R8vP69Ono-fi_p6ysrrOprailq6mxv_zw_O3R_On06ej5-L-nr66zraiqr66r4A%3D%3D&fp=zlT_L2UeLlPrFlPrPrU1FYwIJlm1&tma_jssdk_version=1.7.1.4&rom_version=miui_v10_v10.0.1.0.oebcnfh&ts=1545592651&as=a2950da1db843c1f3f4355&mas=00b3a3d12745a68d7285a73f411d8f9c89a6a2a24206686ea7' -H 'Host: is.snssdk.com' -H 'Proxy-Connection: keep-alive' -H 'Cookie: odin_tt=5bc108effff4529886a0aa36812c115d38b0e739f9abff2139107953c017cc62343bab05794f7fb3075b25846f32c178; UM_distinctid=1655625f84a18e-0897e6c8fc225e-6b55284e-4e4b0-1655625f84c3b; __tea_sdk__ssid=a79e00a6-b717-423f-9e97-f8ac84635f7e; tt_webid=6591877343492081160; __tea_sdk__user_unique_id=6591877343492081160; CNZZDATA1264530760=1269028608-1534945655-%7C1534945655; _ga=GA1.2.1032699944.1534947531; sid_guard=5ccb73ded741fb5f56e64623ca03ac8b%7C1544665500%7C5184000%7CMon%2C+11-Feb-2019+01%3A45%3A00+GMT; uid_tt=1f76f0742e12b4f8a5f32c009d5f7c52; sid_tt=5ccb73ded741fb5f56e64623ca03ac8b; sessionid=5ccb73ded741fb5f56e64623ca03ac8b; alert_coverage=77; install_id=54363182959; ttreq=1$05885f6b61aaffcd5e901e181629f2e1d2851d21; qh[360]=1' -H 'Accept-Encoding: gzip' -H 'X-SS-REQ-TICKET: 1545592651908' -H 'X-Tt-Token: 005ccb73ded741fb5f56e64623ca03ac8bdc236ae81584d4b02df898418e84e101852bddfc64ca324cdf12e2a5ea1d924039' -H 'sdk-version: 1' -H 'User-Agent: Dalvik/2.1.0 (Linux; U; Android 8.1.0; MI 8 SE MIUI/V10.0.1.0.OEBCNFH) NewsArticle/7.0.3 cronet/TTNetVersion:a729d5c3 2018-11-25' -H 'X-SS-TC: 0'
|
19
image/task.yaml
Normal file
19
image/task.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
mode : 0
|
||||
# proxies : "socks5://10.10.10.1:8080" // 支持, 列表 与 单项字符串
|
||||
proxies : ["socks5://10.10.10.1:8080", "socks5://10.10.10.1:8082", "socks5://10.10.10.1:8083", "socks5://10.10.10.1:8085", "socks5://10.10.10.1:8087", "socks5://10.10.10.1:8088", "socks5://10.10.10.1:8091"]
|
||||
retry : 0
|
||||
timeout: 12
|
||||
priority : 10000
|
||||
|
||||
curls : "@task.curl" # 支持, 列表 与 单项字符串
|
||||
|
||||
task: "toutiao"
|
||||
device : "eson-OnePlus"
|
||||
platform : "Android"
|
||||
# area_cc : 4401
|
||||
channel : 105
|
||||
media : 55
|
||||
spider_id : 10001001
|
||||
catch_account_id : 1001001
|
||||
|
||||
crontab: "f8>=240|f5>=120|f=60|s=5|s10>=10|s20>=5"
|
Loading…
Reference in New Issue
Block a user