Full use of https!

https://api.hotaru.icu/api/ipcard?apikey=b699b2d60915d83f3723272855240c4c
查贴吧动态API
当前接口累计调用111次 今日调用0次
查看贴吧用户动态内容 Time:2023-06-28 17:57:49

接口地址: https://api.hotaru.icu/api/tieba

返回类型: application/json

请求方式: GET/POST

请求示例: https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1

请求参数说明:

名称 必填 类型 说明
namestring用户名
pagenumber页数,默认1

返回参数说明:

名称 类型 说明
titlestring标题
contentstring内容摘要
groupstring
timestring时间
urlstringURL

返回示例:

{
    "code": 500,
    "message": "success",
    "data": [
        {
            "title": "1. 回复:笑死我了,如何气死首领",
            "content": "人才啊",
            "group": "部落战争吧",
            "time": "6-27 22:44",
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8479049929&sc=147942326476&from_search=1&pinf=_3_1_65541_@huawel广告歌#147942326476"
        },
        {
            "title": "2. 回复:毛子逆天优惠",
            "content": "啊?",
            "group": "wwr吧",
            "time": "6-26 21:03",
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8478196185&sc=147933878364&from_search=1&pinf=_3_1_65541_@huawel广告歌#147933878364"
        },
        {
            "title": "3. 回复:【EVE手游矿工攻略】手把手教你挖穿新伊甸!",
            "content": "回复  变得讨厌的人 :不行,0.46依旧被系统判定高安",
            "group": "eve手游吧",
            "time": "6-26 19:38",
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=7313898863&sc=147933300251&from_search=1&pinf=_3_1_65541_@huawel广告歌#147933300251"
        },
        {
            "title": "4. 回复:新人想写作,目前的草稿",
            "content": "看完了,没看到有吸引我的地方",
            "group": "起点吧",
            "time": "6-23 12:02",
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8472972847&sc=147908472249&from_search=1&pinf=_3_1_65541_@huawel广告歌#147908472249"
        },
        {
            "title": "5. 回复:高清版植物大战僵尸!",
            "content": "是软件的设置不是系统的",
            "group": "植物大战僵尸吧",
            "time": "6-23 07:23",
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8455074010&sc=147907143646&from_search=1&pinf=_3_1_65541_@huawel广告歌#147907143646"
        },
        {
            "title": "6. 来点端午节笑话",
            "content": "",
            "group": "吧",
            "time": null,
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8472708985&sc=147904792614&from_search=1&pinf=_3_1_65541_@huawel广告歌#147904792614"
        },
        {
            "title": "7. 回复:沉浸式体验泰坦尼克号",
            "content": "",
            "group": "吧",
            "time": null,
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8471399770&sc=147898304538&from_search=1&pinf=_3_1_65541_@huawel广告歌#147898304538"
        },
        {
            "title": "8. 这下地狱笑话了",
            "content": "",
            "group": "吧",
            "time": null,
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8469390815&sc=147888818303&from_search=1&pinf=_3_1_65541_@huawel广告歌#147888818303"
        },
        {
            "title": "9. 回复:300多就抽了这么点",
            "content": "回复  iFruit :",
            "group": "wwr吧",
            "time": "6-20 13:45",
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8469090235&sc=147888300697&from_search=1&pinf=_3_1_65541_@huawel广告歌#147888300697"
        },
        {
            "title": "10. 回复:300多就抽了这么点",
            "content": "三百多块钱,还是三百多抽?",
            "group": "wwr吧",
            "time": "6-20 12:42",
            "url": "https://tieba.baidu.com/mo/q---C02A147797BE91C3BDAD1D7F9A92A59A:FG=1--1-3-0--2--wapp_1687946197776_378/m?kz=8469090235&sc=147887927289&from_search=1&pinf=_3_1_65541_@huawel广告歌#147887927289"
        }
    ]
}

状态码说明:

名称 说明
500success
501fail:parameter cannot be empty
502fail:parameter error

调用示例:

PHP:
<?php
$result = file_get_contents("https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1");
var_dump($result);
?>

JavaScript:
const url = "https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1";
fetch(url)
  .then(res => res.json)
  .(res => {
    console.log(res);
  });

Python:
import requests

url="https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1"
payload={}
r = requests.get(url,params=payload)
print(r);

lua:
local httputil = HttpUtil()
local url = "https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1"
local resStr
local res,code = httputil.httpPost(url,str)
    if code ~= 200 then
        ngx.log(ngx.WARN,"code:"..code)
            return resStr
    end
resStr = res

C/C++:
#include <iostream>  
#include <string>  
#include "curl/curl.h"  
using namespace std;  

#pragma comment(lib, "ws2_32.lib")  
#pragma comment(lib, "wldap32.lib")  
#pragma comment(lib, "libcurl.lib")  

size_t req_reply(void *ptr, size_t size, size_t nmemb, void *stream)  
{  
    cout << "----->reply" << endl;  
    string *str = (string*)stream;  
    cout << *str << endl;  
    (*str).append((char*)ptr, size*nmemb);  
    return size * nmemb;  
}  

CURLcode curl_get_req(const std::string &url, std::string &response)  
{  
    CURL *curl = curl_easy_init();  
    CURLcode res;  
    if (curl)  
    {  
        curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);  
        curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);  
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, req_reply);  
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);  
        curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);  
        curl_easy_setopt(curl, CURLOPT_HEADER, 1);  
        curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 3);
        curl_easy_setopt(curl, CURLOPT_TIMEOUT, 3);  
        res = curl_easy_perform(curl);  
    }  
    curl_easy_cleanup(curl);  
    return res;  
}  


int main()  
{  
    curl_global_init(CURL_GLOBAL_ALL);  

    string getUrlStr = "https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1";  
    string getResponseStr;  
    auto res = curl_get_req(getUrlStr, getResponseStr);  
    if (res != CURLE_OK)  
        cerr << "curl_easy_perform() failed: " + string(curl_easy_strerror(res)) << endl;  
    else  
        cout << getResponseStr << endl;  

    curl_global_cleanup();  
    system("pause");  
    return 0;  
}  

Java:
package com.jl.chromeTest;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;

public class Test {

    @org.junit.Test
    public void test() throws Exception{
        String result = get("https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1");
        System.out.println("result====="+result);
    }
    
    public  String get(String url) throws Exception {
        String content = null;
        URLConnection urlConnection = new URL(url).openConnection();
        HttpURLConnection connection = (HttpURLConnection) urlConnection;
        connection.setRequestMethod("GET");
        connection.connect();
        int responseCode = connection.getResponseCode();
        if (responseCode == HttpURLConnection.HTTP_OK) {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader
                (connection.getInputStream(), StandardCharsets.UTF_8));
            StringBuilder bs = new StringBuilder();
            String l;
            while ((l = bufferedReader.readLine()) != null) {
                bs.append(l).append("\n");
            }
            content = bs.toString();
        }
        return content;
    }
}

CS:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String result = new StreamReader(response.GetResponseStream()).ReadToEnd();

Golang:
func httpGet() {
    resp, err :=   http.Get("https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1")
    if err != nil {
    }

    defer resp.Body.Close()
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
    }

    fmt.Println(string(body))
}


EPL:
.版本 2

.局部变量 待返回, 文本型

待返回 = 编码_utf8到gb2312 (到文本 (网页_访问_对象 (“https://api.hotaru.icu/api/tieba?name=huawel%E5%B9%BF%E5%91%8A%E6%AD%8C&page=1”)))