淘宝网 API接口 cat_get - 获得淘宝分类详情

博客介绍了通过cat_get获取淘宝分类详情,给出免费测试网址。展示了女装/女士精品分类下的众多子分类,如半身裙、衬衫等,还包含翻译状态、执行时间、服务器时间等相关信息,api类型为淘宝。

cat_get - 获得淘宝分类详情
在这里插入图片描述
免费测试网址:http://console.open.onebound.cn/console/?i=Ed

Result Object:

{
“items”: {
“item”: [
{
“id”: “16”,
“name”: “女装/女士精品”,
“pid”: “2”,
“root_id”: “2”,
“sub”: [
{
“id”: “1623”,
“pid”: “16”,
“root_id”: “2”,
“name”: “半身裙”,
“note”: “”
},
{
“id”: “121412004”,
“pid”: “16”,
“root_id”: “2”,
“name”: “背心吊带”,
“note”: “”
},
{
“id”: “162104”,
“pid”: “16”,
“root_id”: “2”,
“name”: “衬衫”,
“note”: “”
},
{
“id”: “50011277”,
“pid”: “16”,
“root_id”: “2”,
“name”: “短外套”,
“note”: “”
},
{
“id”: “1629”,
“pid”: “16”,
“root_id”: “2”,
“name”: “大码女装”,
“note”: “”
},
{
“id”: “50008901”,
“pid”: “16”,
“root_id”: “2”,
“name”: “风衣”,
“note”: “”
},
{
“id”: “50010850”,
“pid”: “16”,
“root_id”: “2”,
“name”: “连衣裙”,
“note”: “”
},
{
“id”: “162116”,
“pid”: “16”,
“root_id”: “2”,
“name”: “蕾丝衫/雪纺衫”,
“note”: “”
},
{
“id”: “50013196”,
“pid”: “16”,
“root_id”: “2”,
“name”: “马夹”,
“note”: “”
},
{
“id”: “50000697”,
“pid”: “16”,
“root_id”: “2”,
“name”: “毛针织衫”,
“note”: “”
},
{
“id”: “162103”,
“pid”: “16”,
“root_id”: “2”,
“name”: “毛衣”,
“note”: “”
},
{
“id”: “50013194”,
“pid”: “16”,
“root_id”: “2”,
“name”: “毛呢外套”,
“note”: “”
},
{
“id”: “50008900”,
“pid”: “16”,
“root_id”: “2”,
“name”: “棉衣/棉服”,
“note”: “”
},
{
“id”: “121434004”,
“pid”: “16”,
“root_id”: “2”,
“name”: “抹胸”,
“note”: “”
},
{
“id”: “162205”,
“pid”: “16”,
“root_id”: “2”,
“name”: “牛仔裤”,
“note”: “”
},
{
“id”: “50008904”,
“pid”: “16”,
“root_id”: “2”,
“name”: “皮衣”,
“note”: “”
},
{
“id”: “50008905”,
“pid”: “16”,
“root_id”: “2”,
“name”: “皮草”,
“note”: “”
},
{
“id”: “50000671”,
“pid”: “16”,
“root_id”: “2”,
“name”: “T恤”,
“note”: “”
},
{
“id”: “50008898”,
“pid”: “16”,
“root_id”: “2”,
“name”: “卫衣/绒衫”,
“note”: “”
},
{
“id”: “50008897”,
“pid”: “16”,
“root_id”: “2”,
“name”: “西装”,
“note”: “”
},
{
“id”: “50008899”,
“pid”: “16”,
“root_id”: “2”,
“name”: “羽绒服”,
“note”: “”
},
{
“id”: “50000852”,
“pid”: “16”,
“root_id”: “2”,
“name”: “中老年女装”,
“note”: “”
},
{
“id”: “50011404”,
“pid”: “16”,
“root_id”: “2”,
“name”: “婚纱/旗袍/礼服”,
“note”: “”
},
{
“id”: “1622”,
“pid”: “16”,
“root_id”: “2”,
“name”: “裤子”,
“note”: “”
},
{
“id”: “1624”,
“pid”: “16”,
“root_id”: “2”,
“name”: “套装/学生校服/工作制服”,
“note”: “”
},
{
“id”: “50008906”,
“pid”: “16”,
“root_id”: “2”,
“name”: “唐装/民族服装/舞台服装”,
“note”: “”
}
]
}
]
},
“translate_status”: “”,
“translate_time”: 0.001,
“language”: {
“current_lang”: “zh-CN”,
“source_lang”: “cn”
},
“error”: “”,
“reason”: “”,
“error_code”: “0000”,
“cache”: 0,
“api_info”: “today:2600 max:10000”,
“execution_time”: 0.081,
“server_time”: “Beijing/2020-06-02 08:55:38”,
“call_args”: [],
“api_type”: “taobao”,
“translate_language”: “zh-CN”,
“translate_engine”: “google_cn”,
“server_memory”: “8.05MB”,
“request_id”: “15ed5a38a37069”
}

static void *aucQuery(void *unused) { int ret = 0; struct url_info url_info; bool is_mali = false; #if SUPPORT_CLOUD_UPDATE_AUC_INFO struct auc_info auc_info; #endif unsigned int cat_id = 0; int tmp_id = 0; int index = 0; int index_cat = 0; int index_subcat = 0; unsigned char matched = 0; struct url_entry *tmp_list = NULL; struct url_entry *clean = NULL; unsigned char tmp_url_len; char tmp_url[MAX_URL_LEN] = {0}; printWar("create AUC query thread\n"); while (1) { pthread_mutex_lock(&url_lock); tmp_list = url_list.next; pthread_mutex_unlock(&url_lock); while (tmp_list) { pthread_mutex_lock(&url_lock); tmp_list->process_flag = URL_PROCESSING; pthread_mutex_unlock(&url_lock); url_info.url = tmp_list->url; url_info.info_len = 0; ret = pthread_mutex_trylock(&mali_url_check_lock); if (!ret) { is_mali = web_protection ? is_url_malicious(url_info.url) : false; if (is_mali) { cat_id = URL_CAT_SECURITY; #if DEBUG printWar("cat ret=%d url=%s id=%d info_id=%d\n", cat_id, url_info.url, tmp_list->id, tmp_list->info_id); #endif /* DEBUG */ pthread_mutex_lock(&url_lock); tmp_list->prev->next = tmp_list->next; if (tmp_list->next) { tmp_list->next->prev = tmp_list->prev; } tmp_list->query = 1; tmp_id = tmp_list->id; tmp_list->id = 0; tmp_list->info_id = 0; tmp_list->cat_map = 0; tmp_url_len = tmp_list->url_len; memset(tmp_url, 0, MAX_URL_LEN); strncpy_safe(tmp_url, tmp_list->url, tmp_list->url_len); clean = tmp_list; tmp_list = tmp_list->next; clean->next = NULL; clean->prev = NULL; pthread_mutex_unlock(&url_lock); pthread_mutex_unlock(&mali_url_check_lock); goto block_mali; } else { pthread_mutex_unlock(&mali_url_check_lock); } } if((!opts.use_tp_service && tmp_list->cat_map) || (opts.use_tp_service && (tmp_list->info_id != PCTL_WEB_URL_ID_ALL) && (tmp_list->cat_map & (~URL_CAT_SECURITY)))) { printWar("before send to auc\n"); #if SUPPORT_CLOUD_UPDATE_AUC_INFO update_libauc_url(&auc_info, opts.use_tp_service); ret = auc_query(&url_info, &auc_info, opts.use_tp_service); #else ret = auc_query(&url_info, opts.use_tp_service); #endif printWar("after send to auc\n"); for (index = 0; index < url_info.info_len; index++) { printWar("cat ret=%d url=%s id=%d name=%s\n", ret, url_info.url, url_info.info[index].id, url_info.info[index].name); } } //remove from url_list pthread_mutex_lock(&url_lock); tmp_list->prev->next = tmp_list->next; if (tmp_list->next) { tmp_list->next->prev = tmp_list->prev; } tmp_list->query = 1; tmp_id = tmp_list->id; tmp_list->id = 0; tmp_list->info_id = 0; tmp_list->cat_map = 0; tmp_url_len = tmp_list->url_len; memset(tmp_url, 0, MAX_URL_LEN); strncpy_safe(tmp_url, tmp_list->url, tmp_list->url_len); clean = tmp_list; tmp_list = tmp_list->next; clean->next = NULL; clean->prev = NULL; pthread_mutex_unlock(&url_lock); //send to kernel cat_id = 0; for (index = 0; index < url_info.info_len; index++) { for (index_cat = 0; mapping_table[index_cat][0] > 0; index_cat++) { matched = 0; for (index_subcat = 1; mapping_table[index_cat][index_subcat] >= 0; index_subcat++) { if (url_info.info[index].id == mapping_table[index_cat][index_subcat] || mapping_table[index_cat][index_subcat] == MAX_URL_CAT_DEFAULT) { cat_id |= 0x1 << (mapping_table[index_cat][0] - 1); matched = 1; break; } } if (matched) { break; } } } block_mali: printWar("send to kernel, url=%s cat_id=%x\n", url_info.url, cat_id); url_send(tmp_id, cat_id, tmp_url, tmp_url_len, URL_REQ_CAT); printWar("after send to kernel\n"); } cond_timedwait(500);//500ms } return 0; } 添加注释
最新发布
09-19
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值