抖音根据关键词获取视频列表接口调用展示

以下为淘宝某商品的调用数据作为展示案例

更多API调用示例展示及获取Key和secret请移步以下内容查看

【登录 - 跨境电商平台接口提供商 数据采集公司 数据接口定制服务 企业级数据服务商

 {
    "items": {
        "page": "1",
        "real_total_results": 500,
        "total_results": 500,
        "page_size": 20,
        "pagecount": 25,
        "item": [
            {
                "title": "【主播宠粉】(80抽大包一包一斤多)婴儿湿巾纸手口屁专用湿纸巾",
                "pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/v1_HzLSoted_71168835081404746390575_e088ddeb079ab9c8e212dd283005c0bc_sx_239125_www800-800",
                "promotion_price": 0.05,
                "price": 0.05,
                "sales": 5479433,
                "num_iid": "3538935606442871363",
                "shop_name": "果果阿成旗舰店",
                "shop_id": 19183575,
                "detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3538935606442871363&pick_source=23gNdam"
            },
            {
                "title": "【小杨哥专属】9.9元6包共180抽一次性洗脸巾洁面压缩棉柔纸毛巾",
                "pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/v1_cAdlbkd_71238848515517647770651_844c226262d0c44692ed252bb281862f_sx_126437_www1200-1200",
                "promotion_price": 1.65,
                "price": 1.65,
                "sales": 556220,
                "num_iid": "3561944394905040148",
                "shop_name": "护可柔洗脸巾旗舰店",
                "shop_id": 1446651,
                "detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3561944394905040148&pick_source=23b7kcK"
            },
            {
                "title": "植护纸巾抽纸大包整箱家用餐巾纸面巾纸卫生纸批发4层 20包*90抽",
                "pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/v1_eVDOYK_71208512110462241690410_bd6bf6a0a48d596136fe218629896f8c_sx_381487_www800-800",
                "promotion_price": 29.9,
                "price": 29.9,
                "sales": 4138358,
                "num_iid": "3485828470490151013",
                "shop_name": "植护官方旗舰店",
                "shop_id": 94410,
                "detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3485828470490151013&pick_source=23gdTFo"
            },
            {
                "title": "Sunde卡通印花抽纸卫生纸小包便捷纸巾迷你手帕纸餐巾纸 40抽/8包",
                "pic_url": "https://p6-aio.ecombdimg.com/obj/ecom-shop-material/v1_pociQri_70888856510425009030636_20c6152ec0e51672420be7cceae6d56d_sx_191165_www800-800",
                "promotion_price": 9.9,
                "price": 9.9,
                "sales": 720422,
      

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
由于抖音的API接口是私有的,不能随意调用。因此,如果要获取抖音视频的长链接,需要使用模拟用户操作的方式来获取。以下是一种可能的方法: 1. 使用curl库发送GET请求获取抖音分享链接的HTML源码 ```cpp #include <curl/curl.h> int main() { CURL *curl; CURLcode res; curl_global_init(CURL_GLOBAL_DEFAULT); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://v.douyin.com/e9tX5WY/"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite); FILE *fp = fopen("html.txt", "w"); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); res = curl_easy_perform(curl); curl_easy_cleanup(curl); fclose(fp); } curl_global_cleanup(); return 0; } ``` 在上述代码中,我们使用了curl库发送GET请求,并将返回的HTML源码保存到本地文件html.txt中。 2. 解析HTML源码,获取长链接 ```cpp #include <iostream> #include <fstream> #include <regex> int main() { std::ifstream ifs("html.txt"); std::string html((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>())); std::regex reg("(?<=playAddr: \")\\S*(?=\")"); std::smatch match; if (std::regex_search(html, match, reg)) { std::cout << match[0] << std::endl; } return 0; } ``` 在上述代码中,我们使用正则表达式解析HTML源码,获取长链接。具体来说,我们使用了一个正则表达式来匹配HTML源码中的长链接。该正则表达式匹配的是以"playAddr: "开头,以"\""结尾的字符串。 需要注意的是,以上代码仅供学习参考,不建议用于商业用途或者非法用途。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值