快手 无水印解析 支持背景音乐 (可建站)
本帖最后由 dpc520 于 2022-10-25 22:36 编辑皮皮搞笑无水印解析
皮皮虾无水印解析源码
微视无水印解析视频源码
西瓜视频无水印解析源码
抖音视频无水印解析源码
快手规则改了 很多软件都失效了 这是今天刚出炉的
功能:
无水印下载
背景音乐获取
评论区获取(部分)
作品封面
作者ID
作者头像
作者粉丝
作者作品数量
作者关注
发布时间
可以使用ASP.NET直接搭建网站 功能都挺全的
EXE成品后面发
给个免费的评分来点动力!!
已经封装好了使用直接调用即可 简单粗暴
调用:
Ks k = new Ks();
k.GetAll("https://v.kuaishou.com/stmhgV 我们疯狂的那年 已经越走越远. 该作品在快手被播放过2.8万次,点击链接,打开【快手】直接观看!");
Console.WriteLine("无水印视频:" + k.GetMp4() + "\n");
Console.WriteLine("完整版背景音乐:" + k.GetMp3() + "\n");
Console.WriteLine("标题:"+k.GetTitle() + "\n");
Console.WriteLine("封面:" + k.GetCover() + "\n");
Console.WriteLine("发布时间:"+k.GetReleaseTime() + "\n");
Console.WriteLine("作者头像:"+k.GetHeadeImage() + "\n");
Console.WriteLine("作者名称:"+k.GetAuthorName() + "\n");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Collections;
using Newtonsoft.Json.Linq;
using System.Security.Policy;
using System.Data;
namespace Ks_Jx
{
public class Ks
{
JObject Json;//作品的JS
JObject JsonComment;
public string GetLowerUrl(string url)
{
url = url.Substring(url.IndexOf("https://v.kuaishou.com"), 29);
//分割出短链接
return url;
}
public string GetLongUrl(string url)
{
HttpWebRequest Beg = (HttpWebRequest)WebRequest.Create(url);
Beg.AllowAutoRedirect = false;
Beg.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
Beg.UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36";
WebResponse Ret = Beg.GetResponse();
url = Ret.Headers["Location"];
Ret.Dispose();
//得到长链接
return url;
}
public Dictionary<string, string> SplitData(string url)
{
Dictionary<string, string> dic = new Dictionary<string, string>();
url = url.Substring(url.IndexOf("photo") + 22);
string[] array = url.Split('&');
for (int i = 0; i < array.Length; i++)
{
string[] s = array.Split('=');
dic.Add(s, s);
}
return dic;
//分解键值对
}
public void GetJson(string sources, string fid, string shareToken, string shareObjectId, string shareId, string photoId)
{
string postData = $@"
{{""fid"":""{fid}"",""shareToken"":""{shareToken}"",""shareObjectId"":""{shareObjectId}"",
""shareMethod"":""TOKEN"",
""shareId"":""{shareId}"",
""shareResourceType"":""PHOTO_OTHER"",
""shareChannel"":""share_copylink"",
""kpn"":""KUAISHOU"",
""subBiz"":""BROWSE_SLIDE_PHOTO"",
""env"":""SHARE_VIEWER_ENV_TX_TRICK"",
""h5Domain"":""v.m.chenzhongtech.com"",
""photoId"":""{photoId}"",
""isLongVideo"":false}} ";
/*
* 下面是固定值不需要改变
*
* shareMethod
* shareResourceType:
*shareChannel
*kpn
*subBiz
*env
*h5Domain//无参数
*isLongVideo
*/
byte[] Array = Encoding.UTF8.GetBytes(postData);
HttpWebRequest Beg = (HttpWebRequest)WebRequest.Create("https://m.gifshow.com/rest/wd/photo/info?kpn=KUAISHOU&captchaToken=");
Beg.Method = "POST";
Beg.UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36";
Beg.Referer = sources;
Beg.Headers.Add("Cookie", "_did=web_518883321649BCF8; did=web_94a05b1178c34af3b97bc4d644d8c963");
Beg.ContentType = "application/json";
Beg.ContentLength = Array.Length;
Stream St = Beg.GetRequestStream();
St.Write(Array, 0, Array.Length);
HttpWebResponse Ret = (HttpWebResponse)Beg.GetResponse();
StreamReader Read = new StreamReader(Ret.GetResponseStream(), Encoding.UTF8);
string url = Read.ReadToEnd();
St.Dispose();
Ret.Dispose();
Read.Dispose();
Json = JObject.Parse(url);
//得到Json这个接口是关于作品的
}
public string GetMp4() { return Json["photo"]["mainMvUrls"]["url"].ToString(); }
//得到视频
public string GetMp3() { return Json["photo"]["music"]["audioUrls"]["url"].ToString(); }
//得到背景音乐
public string GetTitle() { return Json["shareInfo"]["shareTitle"].ToString(); }
//得到视频标题
public string GetAuthorName() { return Json["photo"]["userName"].ToString(); }
//得到作者名称
public string GetHeadeImage() { return Json["photo"]["headUrl"].ToString(); }
//得到作者头像
public string GetReleaseTime()
{
DateTime dt = new DateTime(new DateTime(1970, 1, 1, 8, 0, 0).Ticks + Convert.ToInt64(Json["photo"]["timestamp"]) * 10000);
return $"{dt.Year}年{dt.Month}月{dt.Day}日 {dt.Hour}时:{dt.Minute}分{dt.Second}秒";
}
//得到发布时间
public string GetUserID() { return Json["photo"]["kwaiId"].ToString(); }
//得到账号ID
public string GetCover() { return Json["photo"]["webpCoverUrls"]["url"].ToString(); }
//得到视频封面
//==============下面是关于粉丝的===============
public string GetFanCount() { return Json["counts"]["fanCount"].ToString(); }
//得到粉丝数量
public string GetAttentionCount() { return Json["counts"]["followCount"].ToString(); }
//得到关注数量
public string videoCount() { return Json["counts"]["photoCount"].ToString(); }
//得到作品数量
public string[] FanList()
{
string[] list = { GetFanCount(), GetAttentionCount(), videoCount() };
//0粉丝数量1关注数量2作品数量
return list;
}
//粉丝集合
public void GetAll(string str)
{
string lower = GetLowerUrl(str); //得到短链接
string longurl = GetLongUrl(lower); //得到长链接
Dictionary<string, string> dic = SplitData(longurl);//分割到参数
GetJson(longurl, dic["fid"], dic["shareToken"], dic["shareObjectId"], dic["shareId"], dic["photoId"]);
//加载
}
//===============下面是评论接口=============
public void Comment(string photoId)
{
byte[] array = Encoding.UTF8.GetBytes($"{{\"photoId\":\"{photoId}\",\"count\":1000}}");
HttpWebRequest Beg = (HttpWebRequest)WebRequest.Create("https://v.m.chenzhongtech.com/rest/wd/photo/comment/list");
Beg.Method = "POST";
Beg.ContentType = "application/json";
Beg.UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36";
Beg.Headers.Add("Cookie", "did=web_94a05b1178c34af3b97bc4d644d8c963; didv=1663392836000");
Beg.ContentLength = array.Length;
Beg.Referer = "https://v.m.chenzhongtech.com/fw/photo/3xf2fu9w2qbbc62?fid=1538398485&cc=share_copylink&followRefer=151&shareMethod=TOKEN&docId=9&kpn=KUAISHOU&subBiz=BROWSE_SLIDE_PHOTO&photoId=3xf2fu9w2qbbc62&shareId=17161594948599&shareToken=X-aeKODbI6NAE1zO&shareResourceType=PHOTO_OTHER&userId=3xeh9u683m77smw&shareType=1&et=1_i%2F2000048841256313987_h3104&shareMode=APP&originShareId=17161594948599&appType=21&shareObjectId=5211227800906946534&shareUrlOpened=0×tamp=1665131446191";
Stream St = Beg.GetRequestStream();
St.Write(array, 0, array.Length);
HttpWebResponse Ret = (HttpWebResponse)Beg.GetResponse();
StreamReader Read = new StreamReader(Ret.GetResponseStream(), Encoding.UTF8);
JsonComment = JObject.Parse(Read.ReadToEnd());
St.Dispose();
Ret.Dispose();
Read.Dispose();
;
}
//得到评论的JSON 需要获得评论信息必须调用一下他
public int GetCommentCount() { return Convert.ToInt32(JsonComment["commentCount"]); }
//得到评论总数
public DataTable GetCommentTable()
{
JArray Root = (JArray)JsonComment["rootComments"];
DataTable CommentTable = new DataTable();
CommentTable.Columns.Add("headurl");//头像
CommentTable.Columns.Add("author_name");//名称
CommentTable.Columns.Add("content");//内容
CommentTable.Columns.Add("authorArea");//ip归属地
CommentTable.Columns.Add("time");//ip归属地
for (int i = 0; i < Root.Count; i++)
{
CommentTable.Rows.Add(Root["headurl"], Root["author_name"], Root["content"], Root["authorArea"], Root["time"]);
}
return CommentTable;
}
//部分快手评论
}
}
string postData = $@"
{{""fid"":""{fid}"",""shareToken"":""{shareToken}"",""shareObjectId"":""{shareObjectId}"",
""shareMethod"":""TOKEN"",
""shareId"":""{shareId}"",
""shareResourceType"":""PHOTO_OTHER"",
""shareChannel"":""share_copylink"",
""kpn"":""KUAISHOU"",
""subBiz"":""BROWSE_SLIDE_PHOTO"",
""env"":""SHARE_VIEWER_ENV_TX_TRICK"",
""h5Domain"":""v.m.chenzhongtech.com"",
""photoId"":""{photoId}"",
""isLongVideo"":false}} ";
看你写参数好累,看着头都大。考虑下匿名类。new { } 博主,快手接口已经失效。经测试返回结果为
{
"result": 2001,
"error_msg": " antispam need captcha",
"request_id": "667473072429297826",
"captchaConfig": "{\"type\":1,\"url\":\"https://captcha.zt.kuaishou.com/rest/zt/captcha/sliding/config\",\"captchaSession\":\"Cgp6dC5jYXB0Y2hhErQC2A1f2mqGUITU-8e2kpc0-VW62iVSmtno5PoFKFoyMvYJPwdeQeNzMKBGmTjomgeqpQnqvKo6PwmiGw0BN8HZuNGzlWRF17iEFRXoWPFDnQGplJufjMWhNCR5ib4lwoxINkS2HxlvrsGMUI4knlA3NDY4Zv0_C7EuR-A7ztjEKN8_pPb3hYM2Ynx9cU_lhj7eAnjTzMbZGNptxYsFnQpwpsLvhnKDHeoAXwHG3xW84ouMrxYZo9DfJK90iAG-oavMCtyssth07iGk_6Uu6D219rFWjTO1Fbkuxsoj2RKs1UCx0Nbh2iOYzucd2gT0yy_ZD8DX10iPkUtN76EfbMZ0r8DWcHQZOE0J3to0BsjyTF2Yk-XTY1lx37Gf_H7oZeCCHOKmAi4pAugohBF8iFUEf9AKw3gaEgwGTEI41EjiurMkmQ-JJIJmgygFMAI\",\"jsSdkUrl\":\"https://ali2.a.yximgs.com/static/captcha/sdk/kwaiCaptcha.bffe9a4c.umd.min.js\",\"bizName\":\"DEFAULT\"}"
}
postman测试图为 楼主好厉害 厉害,谢谢楼主分享 C#写程序,强,谢谢 厉害了啊 感谢楼主分享!厉害! 这个怎么会是啊?
调用 方法GetLongUrl时。WebResponse Ret = Beg.GetResponse();报错
System.Net.WebException:“The remote server returned an error: (302) .”
怎么解决 楼主牛逼 有获取图集的吗 666支持大力支持