本帖最后由 dpc520 于 2022-10-25 22:34 编辑
皮皮搞笑无水印解析
皮皮虾无水印解析
西瓜视频无水印解析
快手视频无水印解析
抖音视频无水印解析
主流的平台都写好了
直接调用简单粗暴
[C#] 纯文本查看 复制代码 Ws w = new Ws("简单又好吃的火腿披萨 奶香浓郁 还拉丝@经纪人小微 >> https://isee.weishi.qq.com/ws/app-pages/share/index.html?wxplay=1&id=7gTB185vd1OF8UWwy&spid=1527258818828920&qua=v1_iph_weishi_8.81.2_275_app_a&chid=100081014&pkg=3670&attach=cp_reserves3_1000370011");
w.GetMp4();//得到无水印视频
w.GetTitle();//得到视频标题
封装好的类库
[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using HtmlAgilityPack;
using Newtonsoft.Json.Linq;
using System.Text.RegularExpressions;
namespace Ws_Jx
{
public class Ws
{
HtmlDocument Doc;
JObject Json;
public Ws(string url)
{
GetUrl(ref url); //截取链接
GetHtml(ref url);//得到html
FromatJson();//格式json
////构造函数
}
public void GetUrl(ref string txt)
{
txt = txt.Substring(txt.IndexOf(">>") + 2);
//得到短链接
}
public void GetHtml(ref string url)
{
var Beg = (HttpWebRequest)WebRequest.Create(url);
Beg.AllowAutoRedirect = false;
Beg.UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36";
var Ret = (HttpWebResponse)Beg.GetResponse();
var Read = new StreamReader(Ret.GetResponseStream(), Encoding.UTF8);
string text = Read.ReadToEnd();
Doc = new HtmlDocument();
Doc.LoadHtml(text);
//得到html
}
public void FromatJson()
{
string json = Doc.DocumentNode.SelectSingleNode("//body/script[1]").InnerText.Substring(30).Replace("; } catch (err) { console.error('[Vise] fail to read initState.'); }", "");
Json = JObject.Parse(json);
//初始化JSON
}
public string GetCreateTime()
{
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
return startTime.AddSeconds(Convert.ToInt64(Json["feedsList"][0]["poster"]["createtime"])).ToString("yyy-MM-dd hh:mm:ss");
}
//发布时间
public string GetAuthorName()
{
return Json["feedsList"][0]["poster"]["nick"].ToString();
}//作者名字
public string GetAuthorHeadImage()
{
return Regex.Unescape(Json["feedsList"][0]["poster"]["avatar"].ToString());
}
//作者头像
public string GetHeightCover()
{
return Regex.Unescape(Json["feedsList"][0]["images"][0]["url"].ToString());
}//高质量封面 1080P
public string GetLowerCover()
{
return Regex.Unescape(Json["feedsList"][0]["images"][1]["url"].ToString());
//低质量封面 200
}
public string GetLinkCount()
{
return Regex.Unescape(Json["feedsList"][0]["dingCount"].ToString());
//点赞数量
}
public string GetCommentCount()
{
return Regex.Unescape(Json["feedsList"][0]["totalCommentNum"].ToString());
//评论数量
}
public string GetPlayNum()
{
return Regex.Unescape(Json["feedsList"][0]["playNum"].ToString());
//播放数量
}
public string GetMp4()
{
return Regex.Unescape(Json["feedsList"][0]["videoUrl"].ToString());
}
//源视频
public string GetTitle()
{
return Regex.Unescape(Json["feedsList"][0]["shareInfo"]["bodyMap"]["0"]["title"].ToString());
}
//视频标题
}
}
|