Contact Us
Back top
Current Location : APIs > 微信公众号
微信公众号 Transactions( 416 )

微信公众号

Intro. : Wechat Subscriptions content

Tag : 新闻自媒体 On Shelves Time : 2016-12-06

Type :

文章 用户信息

Tutorials

Total invocations(updated per hour)

微信公众号文章 1.00 yuan/100calls Test Now

API Mark

Example

-- 请求示例 url 默认请求参数已经做URL编码 curl -i "http://api01.bitspaceman.com:8000/post/weixin?apikey=Your apikey&uid=rmrbwx"
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; import org.json.JSONException; import org.json.JSONObject; import java.io.PrintWriter; import java.net.URLConnection; public class Example { private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); PrintWriter out = new PrintWriter(conn.getOutputStream()); out.print(body); out.flush(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static void main(String[] args) throws IOException, JSONException { // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.bitspaceman.com:8000/post/weixin?apikey=Your apikey&uid=rmrbwx"; JSONObject json = getRequestFromUrl(url);; System.out.println(json.toString()); } }
//using System.Net.Security; //using System.Security.Cryptography.X509Certificates; private const String method = "GET"; static void Main(string[] args) { String bodys = ""; // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.bitspaceman.com:8000/post/weixin?apikey=Your apikey&uid=rmrbwx"; HttpWebRequest httpRequest = null; HttpWebResponse httpResponse = null; if (url.Contains("https://")) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url)); } else { httpRequest = (HttpWebRequest)WebRequest.Create(url); } httpRequest.Method = method; if (0 < bodys.Length) { byte[] data = Encoding.UTF8.GetBytes(bodys); using (Stream stream = httpRequest.GetRequestStream()) { stream.Write(data, 0, data.Length); } } try { httpResponse = (HttpWebResponse)httpRequest.GetResponse(); } catch (WebException ex) { httpResponse = (HttpWebResponse)ex.Response; } Console.WriteLine(httpResponse.StatusCode); Console.WriteLine(httpResponse.Method); Console.WriteLine(httpResponse.Headers); Stream st = httpResponse.GetResponseStream(); StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8")); Console.WriteLine(reader.ReadToEnd()); Console.WriteLine("\n"); } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
<?php $method = "GET"; // 请求示例 url 默认请求参数已经做URL编码 $url = "http://api01.bitspaceman.com:8000/post/weixin?apikey=Your apikey&uid=rmrbwx"; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip"); var_dump(curl_exec($curl)); ?>
# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ from __future__ import print_function import requests # 请求示例 url 默认请求参数已经做URL编码 url = "http://api01.bitspaceman.com:8000/post/weixin?apikey=Your apikey&uid=rmrbwx" headers = { "Accept-Encoding": "gzip", "Connection": "close" } if __name__ == "__main__": r = requests.get(url, headers=headers) json_obj = r.json() print(json_obj)

Request Field( Params marked* means users should choose one from the each marked items to fill in.)

Property Name Type Mandatory Example Description
kw string * nba 查询关键词
uid string * rmrbwx 微信公众号ID
link string * aHR0cDovL21wLndlaXhpbi5xcS5jb20vcz9fX2Jpej1Nak01T0RJMk5EazJNdz09Jm1pZD0yNjU4OTA0NzIyJmlkeD0xJnNuPTBjZGMzMDUyNGY0YmJhM2MwZDY4NjdiYzQ5MDlmOWEzJnNjZW5lPTA= 微信公众号文章链接(base64处理)
catid string * 0 分类搜索 根据输入分类0 返回相应类型文章
pageToken string 翻页值,从API返回结果可以拿到
range string 获取一段时间范围以来的公众号文章(可选参数包括y(年),m(月),w(周),d(天))
sort string 返回内容排序规则 默认时间排序
hasImages string 文章内容是否包含图集 默认全部类型 可选 参数"2"表示返回内容含图集
hasVideo string 文章内容是否包含视频 默认全部类型 可选 参数"2"表示返回内容含视频
contentType string 用于控制返回的content字段内容格式 默认纯文本 可选参数“3”返回html格式内容
keyWordMode string 默认对关键词进行分词查询,选择term模式将不会分词
searchMode string 默认返回一页10条内容 当参数为top时 返回搜索结果前10页内容 响应时间将变慢
beginDate string 指定文章发布日期开始范围 (格式2017-10-01 如果指定为当天 可获该订阅号取实时文章)
endDate string 指定文章发布日期结束范围 (格式 2017-10-07)

Response Fields

Property Name Type Example Description
  • hasNext boolean false false: 无下一页 true:有下一页
  • retcode string 000000 状态码(详见错误码表)
  • appCode string weixin 平台代号
  • dataType string post 数据类型
  • pageToken string null 翻页值 用于获取下一页数据
  • -
    data array [...] 数据内容列表
    • posterId string hiyinyue 微信号
    • idx string 3 当次发布的第几条消息
    • posterScreenName string 环球音乐榜 发布者昵称
    • title string 影视原声 | 《三生三世十里桃花》电视原声带 文章标题
    • url string https://mp.weixin.qq.com/s?src=3 文章临时链接
    • audioUrls array [...] 音频列表
    • originUrl string http://mp.weixin.qq.com/mp/homepage?__biz=MjM5NDEwMTc0MA== 阅读原文链接
    • mid string 2651985684 图文消息ID
    • publishDate number 1486289954 发布日期时间戳
    • content string 最近杨幂、赵又廷领衔主演的古装玄幻电视剧《三生三世十里桃花》热播中,我知道很多人 文章正文
    • origin boolean false 是否原创
    • publishDateStr string 2017-02-05T10:19:14 发布时间(UTC时间)
    • biz string MjM5NDEwMTc0MA== 微信公众平台唯一ID
    • posterOriginId string gh_9f86890bab83 微信公众号原始ID
    • imageUrls array [...] 内容图片链接列表
    • id string B350DCC19DCC48A7ED340ED98C6C5D42BF8D98E5 文章ID
    • videoUrls array [...] 视频链接列表

Returns The Sample

{
    "hasNext": false,
    "retcode": "000000",
    "appCode": "weixin",
    "dataType": "post",
    "pageToken": null,
    "data": [
        {
            "posterId": "hiyinyue",
            "commentCount": null,
            "idx": "3",
            "posterScreenName": "环球音乐榜",
            "title": "影视原声 | 《三生三世十里桃花》电视原声带",
            "url": "https:\/\/mp.weixin.qq.com\/s?src=3×tamp=1508923135&ver=1&signature=KLR57DmkmRbLj4JG94EmvvqQAsRXxzTOCA-iwlEPGn9RZGAAzqeocJcyrIKeuNMC-f05hOrjDtTuPG24oJAI-FLltLeOOUB4wbgtbfeld28prgkdg*eNhYKMYXMR-1sZU36jG4Ostdfq8yLo64cZtF*41eE8vs1crry-UlKa6vE=",
            "audioUrls": [
                "http:\/\/ws.stream.qqmusic.qq.com\/C100001CkBs10UxKxc.m4a?fromtag=46",
                "http:\/\/ws.stream.qqmusic.qq.com\/C100003PtLAa1pC8lh.m4a?fromtag=46",
                "http:\/\/ws.stream.qqmusic.qq.com\/C100000hscqh1l8UlG.m4a?fromtag=46"
            ],
            "originUrl": "http:\/\/mp.weixin.qq.com\/mp\/homepage?__biz=MjM5NDEwMTc0MA==&hid=1&sn=96d9577e150aa0eb1bfdb997716cdb24#wechat_redirect",
            "mid": "2651985684",
            "publishDate": 1486289954,
            "likeCount": null,
            "content": "最近杨幂、赵又廷领衔主演的古装玄幻电视剧《三生三世十里桃花》热播中,我知道很多人都在看,贴心如我,今晚就和大家分享这部热播剧里电视原声带!无论是片头曲《三生三世》还是片尾曲《凉凉》、插曲《思慕》,每一首都好听!张杰《三生三世》张碧晨&杨宗纬《凉凉》往期回顾李宗盛&林忆莲:实力演唱经典老歌林俊杰深情演绎《爱要怎么说出口》李健深情翻唱《我要你》田馥甄走心演唱薛之谦《演员》\/ 点击上方文字,即可聆听好歌 \/>>>>Music Never Sleeps.",
            "origin": false,
            "shareCount": null,
            "publishDateStr": "2017-02-05T10:19:14",
            "biz": "MjM5NDEwMTc0MA==",
            "posterOriginId": "gh_9f86890bab83",
            "imageUrls": [
                "http:\/\/mmbiz.qpic.cn\/mmbiz\/bs2x4DBy2oXBPo3gqTEKrcB6Dic9xibVLPYxzjIuOD2NQdWMibvRXVibQKpVzUNujeNRowYvhjv2tEM6UMo65H3G1Q\/0?wx_fmt=gif",
                "http:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/bs2x4DBy2oUqSAjajYof5qG6JM4IPqQjWxN4Lic10QgDjzIKXS3aAbwDryQWjnIuVMpwdmcZj2ibDhWCIG5UVo5A\/0?wx_fmt=jpeg",
                "http:\/\/mmbiz.qpic.cn\/mmbiz\/pjYlYJ0r33Btluu8Ic7xUsjeW7mvuWPibv8BUyCoNkiaciaTiam5rqGqKlTD0pQ2PJjaliaakuEteFrBrOK8wuqiboWQ\/0?wx_fmt=gif",
                "http:\/\/mmbiz.qpic.cn\/mmbiz\/pjYlYJ0r33Btluu8Ic7xUsjeW7mvuWPibv8BUyCoNkiaciaTiam5rqGqKlTD0pQ2PJjaliaakuEteFrBrOK8wuqiboWQ\/0?wx_fmt=gif",
                "http:\/\/mmbiz.qpic.cn\/mmbiz\/pjYlYJ0r33Btluu8Ic7xUsjeW7mvuWPibv8BUyCoNkiaciaTiam5rqGqKlTD0pQ2PJjaliaakuEteFrBrOK8wuqiboWQ\/0?wx_fmt=gif",
                "http:\/\/mmbiz.qpic.cn\/mmbiz\/bs2x4DBy2oU25licNlZXsdJRsSLNpvbeo0xyvgoB51liaibUmDbxZYz6yhUMHfFMjYNXev06jv7P4uuicbficA1bJBg\/0?wx_fmt=jpeg",
                "http:\/\/mmbiz.qpic.cn\/mmbiz\/bs2x4DBy2oXBPo3gqTEKrcB6Dic9xibVLPyZ2WPqLWUsNWohsX0YoY0cKG1W5PaqvNYkmichPWKhbA5ILF7QiaYccg\/0?wx_fmt=gif"
            ],
            "id": "B350DCC19DCC48A7ED340ED98C6C5D42BF8D98E5B133A534",
            "videoUrls": [
                "https:\/\/v.qq.com\/iframe\/preview.html?vid=p0022w4yvpo&width=500&height=375&auto=0",
                "https:\/\/v.qq.com\/iframe\/preview.html?vid=h00220ueui9&width=500&height=375&auto=0"
            ],
            "viewCount": null
        }
    ]
}

Detailed Data

No Details

Error code

Error Return Value Format : JSON

{

message:"API rate limit exceeded",

retcode:100703

}
Error Code Error Message Detailed Description
100000 Server internal error 服务器内部错误
100001 Network error 网络错误
100002 Search no result 目标参数搜索没结果
100004 Target server error 目标服务器错误
100005 Param error 用户输入参数错误
100301 Account not found 用户帐号不存在
100700 Invalid authentication credentials 授权失败
100701 API stopped 您的当前API已停用
100702 Account stopped 您的账户已停用
100703 API rate limit exceeded 并发已达上限
100704 API maintenance API维护中
100705 API not found with these values API不存在
100706 Please add api first 请先添加api
100707 Number of calls exceeded 调用次数超限
100802 Missing url param 'time' or uri path is not equal to 2 请求路径错误或者缺少"time"参数
100803 Wrong pageToken 参数pageToken有误

Often With The Purchase Of Data