Windows 安装方法:

    CMake 1.32+,生成过程会将 vcpkg 下载好,配置到系统环境变量,然后用 vcpkg 安装依赖库(github 上有列出需要的依赖库)。

  Github 上的示例不全面,一开始不知道如何序列化输出 json,经过一番研究和谷歌,这里给一个示例:

#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
//#include <boost/regex.hpp>
#include <string> //#pragma comment(lib, "C:/Program Files/boost_1_72_0/bin.v2/libs/regex/build/msvc-14.2/release/address-model-64/link-static/threading-multi/libboost_regex-vc142-mt-x64-1_72.lib")
#pragma comment(lib, "C:/cpprestsdk/Build_x64/Binaries/Debug/cpprest142_2_10d.lib") using namespace utility;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams; int main()
{
http_client raw_client(U("https://message.bilibili.com/api/tooltip/query.list.do")); http_request request(methods::GET);
request.headers().add(header_names::accept, L"application/json");
request.headers().add(header_names::user_agent, L"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36");
request.headers().add(header_names::accept_encoding, L"gzip, deflate, br");
pplx::task<json::value> requestTask = raw_client.request(request).then([](http_response response) { return response.extract_json(); });
std::wcout << requestTask.get().serialize() << std::endl;
return 0;
}

  当然也可以不用 lambda 风格,直接:

std::wcout << raw_client.request(request)
.get().extract_json().get().serialize() << std::endl;

  

    

最新文章

  1. console.log(&quot;A&quot;-&quot;B&quot;+&quot;3&quot;)=?
  2. Qt 使用sqlserver
  3. sublime 实用 快捷键
  4. 一个非常简单的返回局部字符数组的C语言程序, 请问其输出结果?
  5. C# 获取汉字的拼音首字母
  6. 重构if...else...或者switch程序块 为 中介者(Mediator)模式.的思考
  7. list.h
  8. hdu_5874_Friends and Enemies(公式题)
  9. Confluence搭建
  10. linux中常用的命令
  11. C#中一些默认的预定义属性
  12. 代理模式(Proxy)
  13. leetcode — longest-consecutive-sequence
  14. 【爬虫】在Xpath中使用正则
  15. WebKit最新特性srcset简介(转)
  16. haproxy实现会话保持
  17. python常见的数据结构
  18. DDR中的一些知识点说明(ODT,ZQ校准,OCT,TDQS)
  19. 【Lua】LuaForWindows_v5.1.4-46安装失败解决方案
  20. Mongodb网络好文章

热门文章

  1. C# ASCII码的转换、转义字符、对照表
  2. 1级搭建类108-Oracle 11gR2 SI FS(Windows Server 2019)公开
  3. 仿ios按钮切换
  4. 如何在任意文件下启动jupyter notebook,而不用担心环境配置问题
  5. 曼孚科技:AI领域3种典型的深度学习算法
  6. ubuntu set up 4 - 设置和软件
  7. 模拟退火SA刷题记录
  8. Cannot resolve collation conflict between &quot;Chinese_Taiwan_Stroke_CI_AS&quot; and &quot;Chinese_PRC_CI_AS&quot; in UNION ALL operator occurring in SELECT statement column 1.
  9. 移动端调试神器vConsole
  10. Django文件夹