网易新闻详情
ALAPI 官方文档
通过网易新闻 docid, 获取新闻的主体详情解析
基本说明:
接口地址:https://v2.alapi.cn/api/new/detail
返回格式:json
请求方式:get/post
请求示例:https://v2.alapi.cn/api/new/detail?docid=EQ1NGK0I0001875P&token=token
请求参数说明:
名称 类型 必填 说明
token string 必填 请求token 扫码关注公众号
docid string 必填 起始页,网易新闻的docid
返回参数说明:
名称 类型 说明
- - -
JSON返回示例:
{
	"code": 200,
	"msg": "success",
	"data": {
		"EQ1NGK0I0001875P": {
			"template": "normal",
			"img": [],
			"searchKw": [],
			"picCards": [],
			"topiclist_news": [{
					"ename": "yaowenspecial",
					"hasCover": false,
					"tname": "要闻",
					"alias": "yaowenspecial",
					"subnum": "0",
					"tid": "T1467284926140",
					"cid": "C1348647991705"
				},
				{
					"ename": "androidnews",
					"hasCover": false,
					"tname": "头条",
					"alias": "Top News",
					"subnum": "0",
					"tid": "T1348647909107",
					"cid": "C1348646712614"
				},
				{
					"ename": "iosnews",
					"hasCover": false,
					"tname": "头条",
					"alias": "Top News",
					"subnum": "0",
					"tid": "T1348647853363",
					"cid": "C1348646712614"
				}
			],
			"book": [],
			"link": [],
			"shareLink": "https://c.m.163.com/news/a/EQ1NGK0I0001875P.html?spss=newsapp",
			"source": "梨视频",
			"video": [{
				"broadcast": "in",
				"sizeHD": 4330,
				"url_mp4": "http://flv3.bn.netease.com/videolib1/1909/26/6z3cxw5dr/SD/6z3cxw5dr-mobile.mp4",
				"videoRatio": 1.78,
				"alt": "车祸瞬间,妈妈护住孩子自己却身亡",
				"mp4Hd_url": "http://flv3.bn.netease.com/videolib1/1909/26/6z3cxw5dr/HD/6z3cxw5dr-mobile.mp4",
				"length": 63,
				"videosource": "其他",
				"appurl": "",
				"m3u8Hd_url": "http://flv0.bn.netease.com/videolib1/1909/26/6z3cxw5dr/HD/movie_index.m3u8",
				"mp4_url": "http://flv3.bn.netease.com/videolib1/1909/26/6z3cxw5dr/SD/6z3cxw5dr-mobile.mp4",
				"sizeSD": 2524,
				"sid": "",
				"cover": "http://videoimg.nos-jd.163yun.com/cmssnapshot/20190926/cyiP11383_4.jpg",
				"vid": "VKP3TDN30",
				"url_m3u8": "http://flv3.bn.netease.com/videolib1/1909/26/6z3cxw5dr/SD/6z3cxw5dr-mobile.mp4",
				"sizeSHD": 0,
				"ref": "<!--VIDEO#0-->",
				"topicid": "00019FGD",
				"commentboard": "video_bbs",
				"size": "",
				"commentid": "KP3TDN30050835RB",
				"m3u8_url": "http://flv0.bn.netease.com/videolib1/1909/26/6z3cxw5dr/SD/movie_index.m3u8"
			}],
			"threadVote": 77,
			"title": "母亲车祸瞬间用身体护住3岁孩子 自己却不幸身亡",
			"body": "<p><!--VIDEO#0--></p><p>  2019年9月25日,辽宁沈阳,一女子带孩子过马路被一轿车撞倒。医护人员赶到现场后,宣布女子已死亡,万幸的是孩子没有受伤。据市民介绍,该女子是在接孩子放学回家途中遭遇车祸的,被撞倒瞬间,女子本能的抱住孩子。</p><p>原标题:车祸瞬间,妈妈护住孩子自己却身亡</p><p><!--viewpoint--></p>",
			"tid": "",
			"picnews": true,
			"advertiseType": "0001",
			"articleType": "normal",
			"digest": "",
			"boboList": [],
			"ptime": "2019-09-26 23:30:41",
			"ec": "刘效武_NN4113",
			"docid": "EQ1NGK0I0001875P",
			"threadAgainst": 5,
			"hasNext": false,
			"recImgsrc": "http://cms-bucket.ws.126.net/2019/09/26/7ca05dca65f8478f962b3856f089616b.png",
			"dkeys": "车祸,轿车,本能,沈阳,辽宁",
			"ydbaike": [],
			"hidePlane": false,
			"replyCount": 2879,
			"voicecomment": "off",
			"replyBoard": "news_shehui7_bbs",
			"votes": [],
			"topiclist": []
		}
	},
	"Author": {
		"name": "Alone88",
		"desc": "由Alone88提供的免费API 服务,官方文档:www.alapi.cn"
	}
}
服务级错误码参照
错误码 说明
500 处理异常
完整教学代码示例
<?php

/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2020/02/01 00:16
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://v1.alapi.cn/api/new/detail?docid=EQ1NGK0I0001875P';
    }

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

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

const (
	APIURL   = "https://v1.alapi.cn/api/new/detail"
)

func main() {
	queryUrl := fmt.Sprintf("%s?docid=EQ1NGK0I0001875P",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))
}