c++ 解析 url parse url CxxUrl

创建日期: 2024-06-28 14:54 | 作者: 风波 | 浏览次数: 14 | 分类: C++

项目地址:https://github.com/chmike/CxxUrl

1. 下载代码

https://github.com/chmike/CxxUrl.git

2. 编译

cd CxxUrl && cmake . && make

编译后生成 libCxxUrl.so

3. 使用 libCxxUrl.so

#include <iostream>
#include "url.hpp"


int main() {
    auto homepage = "https://www.so.fengbohello.top/";
    Url u{homepage};

    Url bu;
    bu.clear().scheme(url.scheme()).host(url.host());
    if(!u.port().empty()) {
        bu.port(u.port());
    }
    auto rooturl = bu.str();

    std::cout << "root url: " << rooturl << std::endl;

    return 0;
}
14 浏览
9 爬虫
0 评论