1.抓微信的正文主要是调用第三方的接口(https://market.aliyun.com/products/56928004/cmapi012134.html)

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks; namespace QBSqlServer.GSDataAPIs.GetHtml
{
public class WeChatPublicNumberQueryAPI
{
private const String host = "https://ali-weixin.showapi.com";
private const String path = "/582-9";
private const String method = "GET";
private const String appcode = "你自己的appcode"; public static Root GetWeChathtml(string title)
{
string outhtml = string.Empty;
string t = System.Web.HttpUtility.UrlEncode(title);
//String querys = "needComment=0&needContent=1&url=url";
String querys = "needContent=1&url=" + t;
String bodys = "";
String url = host + path;
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null; if ( < querys.Length)
{
url = url + "?" + querys;
} if (host.Contains("https://"))
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
}
else
{
httpRequest = (HttpWebRequest)WebRequest.Create(url);
}
httpRequest.Method = method;
httpRequest.Headers.Add("Authorization", "APPCODE " + appcode);
if ( < bodys.Length)
{
byte[] data = Encoding.UTF8.GetBytes(bodys);
using (Stream stream = httpRequest.GetRequestStream())
{
stream.Write(data, , 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"));
string strResult = reader.ReadToEnd();
Root jobInfoList = JsonConvert.DeserializeObject<Root>(strResult);
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine("\n");
return jobInfoList;
} public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}
} public class Showapi_res_body
{
/// <summary>
///
/// </summary>
public string newUrl { get; set; }
/// <summary>
///
/// </summary>
public string date { get; set; }
/// <summary>
///
/// </summary>
public string weixinNum { get; set; }
/// <summary>
/// 这是正文的html
/// </summary>
public string content { get; set; }
/// <summary>
///
/// </summary>
public string ret_code { get; set; }
/// <summary>
/// 秀场|中国品牌ELLASSAY米兰时装周首秀!
/// </summary>
public string title { get; set; }
/// <summary>
///
/// </summary>
public string contentImg { get; set; }
/// <summary>
///
/// </summary>
public string userLogo { get; set; }
/// <summary>
///
/// </summary>
public string oldUrl { get; set; }
/// <summary>
/// 徐峰立
/// </summary>
public string userName { get; set; }
/// <summary>
///
/// </summary>
public string read_num { get; set; }
/// <summary>
///
/// </summary>
public string like_num { get; set; }
/// <summary>
///
/// </summary>
public string userLogo_code { get; set; }
} public class Root
{
/// <summary>
///
/// </summary>
public string showapi_res_code { get; set; }
/// <summary>
///
/// </summary>
public string showapi_res_error { get; set; }
/// <summary>
///
/// </summary>
public Showapi_res_body showapi_res_body { get; set; }
}
}

asp.net MVC 抓取微信文章数据(正文)的更多相关文章

  1. asp.net mvc抓取微信文章里面所有的图片

    /// <summary> /// 下载指定URL下的所有图片 /// </summary> public class WebPageImage { /// <summa ...

  2. asp.net mvc 抓取京东商城分类

    555 asp.net mvc 抓取京东商城分类   URL:http://www.jd.com/allSort.aspx   效果:   //后台代码 public ActionResult Get ...

  3. [Python爬虫] 之十五:Selenium +phantomjs根据微信公众号抓取微信文章

    借助搜索微信搜索引擎进行抓取 抓取过程 1.首先在搜狗的微信搜索页面测试一下,这样能够让我们的思路更加清晰 在搜索引擎上使用微信公众号英文名进行“搜公众号”操作(因为公众号英文名是公众号唯一的,而中文 ...

  4. 使用redis所维护的代理池抓取微信文章

    搜狗搜索可以直接搜索微信文章,本次就是利用搜狗搜搜出微信文章,获得详细的文章url来得到文章的信息.并把我们感兴趣的内容存入到mongodb中. 因为搜狗搜索微信文章的反爬虫比较强,经常封IP,所以要 ...

  5. 如何利用Python网络爬虫抓取微信好友数量以及微信好友的男女比例

    前几天给大家分享了利用Python网络爬虫抓取微信朋友圈的动态(上)和利用Python网络爬虫爬取微信朋友圈动态——附代码(下),并且对抓取到的数据进行了Python词云和wordart可视化,感兴趣 ...

  6. Charles抓取微信小程序数据 以及 其它应用网站数据

    为了抓取小程序数据所以使用Charles来抓取,下面介绍下使用方法(mac环境下使用).使用Charles可以非常方便的抓取Http/Https请求.官方dmg下载地址:点击此处下载 Charles抓 ...

  7. 使用Fiddler抓取微信饿了么小程序数据

    使用Fiddler抓取微信饿了么小程序数据 准备 一部装载Android 7.0以下的手机:此处使用华为荣耀5x 微信小程序7.0以下版本:此处为6.6.7.此处可通过豌豆荚应用下载. 安装好的Fid ...

  8. 如何利用Python网络爬虫抓取微信朋友圈的动态(上)

    今天小编给大家分享一下如何利用Python网络爬虫抓取微信朋友圈的动态信息,实际上如果单独的去爬取朋友圈的话,难度会非常大,因为微信没有提供向网易云音乐这样的API接口,所以很容易找不到门.不过不要慌 ...

  9. 利用Python网络爬虫抓取微信好友的签名及其可视化展示

    前几天给大家分享了如何利用Python词云和wordart可视化工具对朋友圈数据进行可视化,利用Python网络爬虫抓取微信好友数量以及微信好友的男女比例,以及利用Python网络爬虫抓取微信好友的所 ...

随机推荐

  1. java集合——Map

    声明:以下内容都是来自网络总结,将会参考很多,没有声明转载来源. 一.Map接口 1.HashMap HashMap和HashTable的区别:http://blog.csdn.net/shohoku ...

  2. 感知机模型到DNN模型

    参考资料 感知机模型:https://www.cnblogs.com/pinard/p/6042320.html DNN:https://www.cnblogs.com/pinard/p/641866 ...

  3. union all 和 union 的 区别

    https://www.cnblogs.com/wen-zi/p/9133754.html 主要: Union:对两个结果集进行并集操作,不包括重复行,同时进行默认规则的排序: Union All:对 ...

  4. Oracle 中的 Profile

    一.目的: Oracle系统中的profile可以用来对用户所能使用的数据库资源进行限制,使用Create Profile命令创建一个Profile,用它来实现对数据库资源的限制使用,如果把该prof ...

  5. word中英文双引号的样式区分与替换技巧

    https://jingyan.baidu.com/article/3f16e003147ea42590c10349.html 场景:一篇word文档中,想要全选更改字体,使得中文全部为“宋体”,英文 ...

  6. LC 989. Add to Array-Form of Integer

    For a non-negative integer X, the array-form of X is an array of its digits in left to right order.  ...

  7. Ionic4.x 中的 UI 组件(UI Components) 侧边栏ion-menu组件以及底部tabs结合 侧边栏 ion-menu

    1.侧边栏 ion-menu 组件的基本使用 1.创建项目 ionic start myApp sidemenu 2.配置项目 属性 作用 可选值 side 配置侧边栏的位置 start end me ...

  8. ES6深入浅出-1 新版变量声明:let 和 const-3.视频 相关面试题

    执行顺序问题 请问console.log输出的值是多少 输出的肯定是1 假如这里有一行未知的代码 会打印出几? 如果这段未知的代码是a=2.那么其实console输出的就是2 只关心代码,没有关心代码 ...

  9. VM12_pro+Ubuntu16_64+Qt5.12.2环境搭建

    1.准备软件[已经存网盘] 2.安装Vm 3.安装Ubuntu 4.进入linux,修改Qt安装包权限 5.运行Qt 6.第五步会弹出Qt安装的界面,默认安装就行了 7.修改环境变量 sudo ged ...

  10. 【408】C函数中的ADT

    类似类的形式 boardADT.h:所有的宏.声明等部分写在这里 boardADT.c:只需要 #inclue "boardADT.h",不需要 include 其他系统头文件,然 ...