网页所有链接
其他 官方文档
提取指定网页内所有链接信息并归类
基本说明:
接口地址:https://cn.apihz.cn/api/wangzhan/getres.php
返回格式:json
请求方式:get/post
请求示例:https://cn.apihz.cn/api/wangzhan/getres.php?id=6&key=6&type=1&url=www.baidu.com
请求参数说明:
名称 类型 必填 说明
id int 必填 用户ID
key int 必填 密钥 扫码关注公众号
url string 必填 指定网址,如果网站参数里有&符号,请替换成@再用英文括号括起来
type int 必填 指定访问节点,1=国内,2=香港,3=美国,默认国内
返回参数说明:
名称 类型 说明
img array 照片
video array 视频
JSON返回示例:
{
	"code": 200,
	"img": ["\/pku_logo_red.png"],
	"video": [],
	"music": [],
	"package": [],
	"document": [],
	"css": ["\/Public\/static\/themes\/css\/jquery.mCustomScrollbar.css", "\/Public\/static\/themes\/css\/global.css", "\/Public\/static\/themes\/css\/fix.css", "\/Public\/static\/themes\/css\/slick.css"],
	"js": ["\/Public\/static\/themes\/js\/jquery.js", "\/Public\/static\/themes\/js\/jquery.easing.js", "\/Public\/static\/themes\/js\/jquery.mousewheel.js", "\/Public\/static\/themes\/js\/global.js", "\/Public\/static\/themes\/js\/fun.js", "\/Public\/static\/themes\/js\/plus\/old\/winscreen.js", "\/Public\/static\/themes\/js\/plus\/jquery.mChange.js", "\/Public\/static\/themes\/js\/plus\/jquery.mScroll.js", "\/Public\/static\/themes\/js\/plus\/vivus.js", "\/Public\/static\/themes\/js\/jquery.mCustomScrollbar.js", "\/Public\/static\/themes\/js\/iscroll.js", "\/Public\/static\/themes\/js\/slick.js", "\/Public\/static\/themes\/js\/homeJson.js", "\/Public\/static\/themes\/js\/plus\/jquery.imgpreload.js"],
	"html": ["\/home\/student.html", "\/teachers.html", "\/visit.html", "\/leader_email.html", "\/about.html", "\/recruit.html", "\/department.html", "\/education.html", "\/scientificResearch.html", "\/cooperation.html", "\/campus.html", "\/leaders.html", "\/old_secretary.html", "\/group.html", "\/historyFamous.html", "\/IdentificationSystem.html", "\/close-up_pku2024.html", "\/notices.html", "\/statement.html", "https:\/\/www.pku.edu.cn\/visit.html", "\/index.html", "\/mathScience.html", "\/detail\/538.html", "\/detail\/534.html", "\/detail\/530.html", "\/detail\/527.html", "\/detail\/524.html", "\/detail\/522.html", "\/detail\/519.html", "\/detail\/515.html", "\/detail\/514.html", "\/detail\/511.html", "\/detail\/508.html", "\/detail\/506.html", "\/detail\/505.html", "\/detail\/529.html", "\/detail\/902.html", "\/detail\/905.html", "\/detail\/907.html", "\/detail\/908.html", "\/detail\/909.html", "\/detail\/910.html", "\/detail\/911.html", "\/detail\/912.html", "\/detail\/913.html", "\/shiYuan.html"],
	"php": ["https:\/\/dean.pku.edu.cn\/service\/web\/courseSearch.php"],
	"other": ["javascript:;", "http:\/\/www.pku.org.cn\/"]
}
服务级错误码参照
错误码 说明
400 通讯秘钥不正确!或url参数不能为空!
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2024/5/10 07:11
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://cn.apihz.cn/api/wangzhan/getres.php?id=88888888&key=88888888&type=1&url=www.baidu.com';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "https://cn.apihz.cn/api/wangzhan/getres.php?id=88888888&key=88888888&type=1&url=www.baidu.com"
)

func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}