Skip to content

Commit

Permalink
Merge pull request #8 from xiaoyaocz/feature_uitweaks
Browse files Browse the repository at this point in the history
UI调整并API完善
  • Loading branch information
ThomasWFan authored Nov 21, 2016
2 parents 01acb0f + a99290f commit 892bb57
Show file tree
Hide file tree
Showing 85 changed files with 2,043 additions and 1,207 deletions.
Binary file added bilibili2.VC.db
Binary file not shown.
1 change: 1 addition & 0 deletions bilibili2.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F3876E5E-323D-40EF-A340-0C007449F2C3}.Debug|Any CPU.ActiveCfg = Debug|x86
{F3876E5E-323D-40EF-A340-0C007449F2C3}.Debug|Any CPU.Build.0 = Debug|x86
{F3876E5E-323D-40EF-A340-0C007449F2C3}.Debug|Any CPU.Deploy.0 = Debug|x86
{F3876E5E-323D-40EF-A340-0C007449F2C3}.Debug|ARM.ActiveCfg = Debug|ARM
{F3876E5E-323D-40EF-A340-0C007449F2C3}.Debug|ARM.Build.0 = Debug|ARM
{F3876E5E-323D-40EF-A340-0C007449F2C3}.Debug|ARM.Deploy.0 = Debug|ARM
Expand Down
2 changes: 1 addition & 1 deletion bilibili2/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<SolidColorBrush x:Key="Bili-MenuBack" Color="White"></SolidColorBrush>



</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
Expand Down
1 change: 1 addition & 0 deletions bilibili2/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ protected override async void OnActivated(IActivatedEventArgs args)

}
await JYAnalytics.StartTrackAsync(ApiHelper.JyAppkey);


}

Expand Down
Binary file removed bilibili2/Assets/LOGO89.png
Binary file not shown.
Binary file added bilibili2/Assets/LOGOTITLE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/LogoTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/NewStoreLogo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/NewStoreLogo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/NewStoreLogo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/NewStoreLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/NewStoreLogo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square150x150Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square150x150Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square150x150Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bilibili2/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square150x150Logo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square310x310Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square310x310Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square310x310Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square310x310Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square310x310Logo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square44x44Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square44x44Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square44x44Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bilibili2/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square44x44Logo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square44x44Logo.targetsize-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bilibili2/Assets/Square44x44Logo.targetsize-24.png
Binary file added bilibili2/Assets/Square44x44Logo.targetsize-32.png
Binary file added bilibili2/Assets/Square44x44Logo.targetsize-48.png
Binary file added bilibili2/Assets/Square71x71Logo.scale-100.png
Binary file modified bilibili2/Assets/Square71x71Logo.scale-125.png
Binary file added bilibili2/Assets/Square71x71Logo.scale-150.png
Binary file added bilibili2/Assets/Square71x71Logo.scale-200.png
Binary file added bilibili2/Assets/Square71x71Logo.scale-400.png
10 changes: 6 additions & 4 deletions bilibili2/BundleArtifacts/Upload/arm.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
MainPackage=F:\UWP开发\APP项目\bilibili2\bilibili2\bin\ARM\Release\Upload\bilibili2_2.7.1.0_ARM.appx
SymbolPackage=F:\UWP开发\APP项目\bilibili2\bilibili2\AppPackages\bilibili2_2.7.1.0\bilibili2_2.7.1.0_ARM.appxsym
ResourcePack=F:\UWP开发\APP项目\bilibili2\bilibili2\_scale-100.appx
ResourcePack=F:\UWP开发\APP项目\bilibili2\bilibili2\_scale-125.appx
MainPackage=E:\UWP\bilibili2\bilibili2\bin\ARM\Release\Upload\bilibili2_2.7.8.0_ARM.appx
SymbolPackage=E:\UWP\bilibili2\bilibili2\AppPackages\bilibili2_2.7.8.0\bilibili2_2.7.8.0_ARM.appxsym
ResourcePack=E:\UWP\bilibili2\bilibili2\_scale-100.appx
ResourcePack=E:\UWP\bilibili2\bilibili2\_scale-125.appx
ResourcePack=E:\UWP\bilibili2\bilibili2\_scale-150.appx
ResourcePack=E:\UWP\bilibili2\bilibili2\_scale-400.appx
4 changes: 2 additions & 2 deletions bilibili2/BundleArtifacts/Upload/x64.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MainPackage=F:\UWP开发\APP项目\bilibili2\bilibili2\bin\x64\Release\Upload\bilibili2_2.7.1.0_x64.appx
SymbolPackage=F:\UWP开发\APP项目\bilibili2\bilibili2\AppPackages\bilibili2_2.7.1.0\bilibili2_2.7.1.0_x64.appxsym
MainPackage=E:\UWP\bilibili2\bilibili2\bin\x64\Release\Upload\bilibili2_2.7.8.0_x64.appx
SymbolPackage=E:\UWP\bilibili2\bilibili2\AppPackages\bilibili2_2.7.8.0\bilibili2_2.7.8.0_x64.appxsym
4 changes: 2 additions & 2 deletions bilibili2/BundleArtifacts/Upload/x86.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MainPackage=F:\UWP开发\APP项目\bilibili2\bilibili2\bin\x86\Release\Upload\bilibili2_2.7.1.0_x86.appx
SymbolPackage=F:\UWP开发\APP项目\bilibili2\bilibili2\AppPackages\bilibili2_2.7.1.0\bilibili2_2.7.1.0_x86.appxsym
MainPackage=E:\UWP\bilibili2\bilibili2\bin\x86\Release\Upload\bilibili2_2.7.8.0_x86.appx
SymbolPackage=E:\UWP\bilibili2\bilibili2\AppPackages\bilibili2_2.7.8.0\bilibili2_2.7.8.0_x86.appxsym
10 changes: 6 additions & 4 deletions bilibili2/BundleArtifacts/arm.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
MainPackage=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\bin\ARM\Debug\bilibili2_2.7.1.0_ARM_Debug.appx
SymbolPackage=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\AppPackages\bilibili2_2.7.1.0_Debug_Test\bilibili2_2.7.1.0_ARM_Debug.appxsym
ResourcePack=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\bin\ARM\Debug\bilibili2_2.7.1.0_scale-100.appx
ResourcePack=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\bin\ARM\Debug\bilibili2_2.7.1.0_scale-125.appx
MainPackage=E:\UWP\bilibili2\bilibili2\bin\ARM\Release\bilibili2_2.7.8.0_ARM.appx
SymbolPackage=E:\UWP\bilibili2\bilibili2\AppPackages\bilibili2_2.7.8.0_Test\bilibili2_2.7.8.0_ARM.appxsym
ResourcePack=E:\UWP\bilibili2\bilibili2\bin\ARM\Release\bilibili2_2.7.8.0_scale-100.appx
ResourcePack=E:\UWP\bilibili2\bilibili2\bin\ARM\Release\bilibili2_2.7.8.0_scale-125.appx
ResourcePack=E:\UWP\bilibili2\bilibili2\bin\ARM\Release\bilibili2_2.7.8.0_scale-150.appx
ResourcePack=E:\UWP\bilibili2\bilibili2\bin\ARM\Release\bilibili2_2.7.8.0_scale-400.appx
4 changes: 2 additions & 2 deletions bilibili2/BundleArtifacts/x64.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MainPackage=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\bin\x64\Debug\bilibili2_2.7.1.0_x64_Debug.appx
SymbolPackage=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\AppPackages\bilibili2_2.7.1.0_Debug_Test\bilibili2_2.7.1.0_x64_Debug.appxsym
MainPackage=E:\UWP\bilibili2\bilibili2\bin\x64\Release\bilibili2_2.7.8.0_x64.appx
SymbolPackage=E:\UWP\bilibili2\bilibili2\AppPackages\bilibili2_2.7.8.0_Test\bilibili2_2.7.8.0_x64.appxsym
4 changes: 2 additions & 2 deletions bilibili2/BundleArtifacts/x86.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MainPackage=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\bin\x86\Debug\bilibili2_2.7.1.0_x86_Debug.appx
SymbolPackage=E:\Documents\Visual Studio 2015\Projects\BiliBili-UWP\bilibili2\AppPackages\bilibili2_2.7.1.0_Debug_Test\bilibili2_2.7.1.0_x86_Debug.appxsym
MainPackage=E:\UWP\bilibili2\bilibili2\bin\x86\Release\bilibili2_2.7.8.0_x86.appx
SymbolPackage=E:\UWP\bilibili2\bilibili2\AppPackages\bilibili2_2.7.8.0_Test\bilibili2_2.7.8.0_x86.appxsym
36 changes: 31 additions & 5 deletions bilibili2/Class/ApiHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BILIBILI_UWP.Class;
using bilibili2.Controls;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
Expand Down Expand Up @@ -27,7 +28,7 @@ class ApiHelper
public const string _appSecret_Wp = "ba3a4e554e9a6e15dc4d1d70c2b154e3";//Wp
public const string _appSecret_IOS = "8cb98205e9b2ad3669aad0fce12a4c13";//Ios
public const string _appSecret_Android = "ea85624dfcf12d7cc7b2b3a94fac1f2c";//Android
public const string _appSecret_DONTNOT = "2ad42749773c441109bdc0191257a664";//Android
public const string _appSecret_DONTNOT = "2ad42749773c441109bdc0191257a664";

public const string _appKey = "422fd9d7289a1dd9";//Wp
public const string _appKey_IOS = "4ebafd7c4951b366";
Expand Down Expand Up @@ -102,8 +103,32 @@ public static string GetSign_DN(string url)
}
public static long GetTimeSpen
{
get { return Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds); }
get { return Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 8, 0, 0, 0)).TotalSeconds); }
}
public static long GetTimeSpen_2
{
get { return Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 8, 0, 0, 0)).TotalMilliseconds); }
}
public static List<EmojiModel> emojis;
public static List<FaceModel> emoji;
public static async void SetEmojis()
{
try
{
WebClientClass wc = new WebClientClass();
string url = "http://api.bilibili.com/x/v2/reply/emojis";
string results = await wc.GetResults(new Uri(url));
FaceModel model = JsonConvert.DeserializeObject<FaceModel>(results);
emoji = model.data;
emojis = new List<EmojiModel>();
model.data.ForEach(x => x.emojis.ForEach(y => emojis.Add(y)));
}
catch (Exception)
{
}

}


public static async Task<string> GetEncryptedPassword(string passWord)
{
Expand All @@ -117,7 +142,7 @@ public static async Task<string> GetEncryptedPassword(string passWord)
httpBaseProtocolFilter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.Untrusted);
Windows.Web.Http.HttpClient httpClient = new Windows.Web.Http.HttpClient(httpBaseProtocolFilter);
//WebClientClass wc = new WebClientClass();
string stringAsync = await httpClient.GetStringAsync((new Uri("https://secure.bilibili.com/login?act=getkey&rnd=" + new Random().Next(1000, 9999), UriKind.Absolute)));
string stringAsync = await httpClient.GetStringAsync((new Uri("https://passport.bilibili.com/login?act=getkey&rnd=" + new Random().Next(1000, 9999), UriKind.Absolute)));
JObject jObjects = JObject.Parse(stringAsync);
string str = jObjects["hash"].ToString();
string str1 = jObjects["key"].ToString();
Expand All @@ -141,10 +166,11 @@ public static async Task<string> LoginBilibili(string UserName, string Password)
{
try
{
//https://api.bilibili.com/login?appkey=422fd9d7289a1dd9&platform=wp&pwd=JPJclVQpH4jwouRcSnngNnuPEq1S1rizxVJjLTg%2FtdqkKOizeIjS4CeRZsQg4%2F500Oye7IP4gWXhCRfHT6pDrboBNNkYywcrAhbOPtdx35ETcPfbjXNGSxteVDXw9Xq1ng0pcP1burNnAYtNRSayEKC1jiugi1LKyWbXpYE6VaM%3D&type=json&userid=xiaoyaocz&sign=74e4c872ec7b9d83d3a8a714e7e3b4b3
//发送第一次请求,得到access_key
WebClientClass wc = new WebClientClass();
string url = "https://api.bilibili.com/login?appkey=422fd9d7289a1dd9&platform=wp&pwd=" + WebUtility.UrlEncode(Password) + "&type=json&userid=" + WebUtility.UrlEncode(UserName);

string url = "https://api.bilibili.com/login?appkey=422fd9d7289a1dd9&platform=wp&pwd=" + WebUtility.UrlEncode(await GetEncryptedPassword(Password)) + "&type=json&userid=" + WebUtility.UrlEncode(UserName);
url += "&sign="+GetSign(url);

string results = await wc.GetResults(new Uri(url));
//Json解析及数据判断
Expand Down
11 changes: 6 additions & 5 deletions bilibili2/Class/DownloadManage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ public async Task<string> GetVideoUri(string cid, int quality)
try
{
wc = new WebClientClass();
string url = "http://interface.bilibili.com/playurl?platform=android&cid=" + cid + "&quality=" + quality + "&otype=json&appkey=422fd9d7289a1dd9&type=mp4";
url+="&sign="+ ApiHelper.GetSign(url);
// url += "&sign=" + ApiHelper.GetSign(url);
//string url = "http://interface.bilibili.com/playurl?platform=android&cid=" + cid + "&quality=" + quality + "&otype=json&appkey=422fd9d7289a1dd9&type=mp4";
string url = "http://interface.bilibili.com/playurl?_device=uwp&cid=" + cid + "&otype=json&quality=" + quality + "&appkey=" + ApiHelper._appKey + "&access_key=" + ApiHelper.access_key + "&type=mp4&mid=" + UserClass.Uid + "&_buvid=D9EFA749-6CCA-43B3-A3D2-20225D874E672072infoc&_hwid=03005a8603001c9a&platform=uwp_desktop" + "&ts=" + ApiHelper.GetTimeSpen;
url += "&sign=" + ApiHelper.GetSign(url);
// url += "&sign=" + ApiHelper.GetSign(url);

string results = "";
VideoUriModel model = null;
Expand All @@ -143,7 +144,7 @@ public async Task<string> GetVideoUri(string cid, int quality)
}
if (!userDlIp && !userTwIp && !useHkIp)
{
results = await wc.GetResults(new Uri(url));
results = await wc.GetResults_Phone(new Uri(url));

model = JsonConvert.DeserializeObject<VideoUriModel>(results);

Expand Down Expand Up @@ -202,7 +203,7 @@ public async void StartDownload(DownModel downModel)
{
if ((bool)setting.GetSettingValue("UseWifi"))
{
downloader.CostPolicy = BackgroundTransferCostPolicy.Always;
downloader.CostPolicy = BackgroundTransferCostPolicy.Default;
}
else
{
Expand Down
30 changes: 30 additions & 0 deletions bilibili2/Class/GetSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace bilibili2.Class
{
public static class GetSetting
{
static SettingHelper st;
public static bool isDark()
{
if (st==null)
{
st = new SettingHelper();
}
if (st.SettingContains("Drak"))
{
return (bool)st.GetSettingValue("Drak");
}
else
{
return false;
}
}


}
}
63 changes: 63 additions & 0 deletions bilibili2/Class/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
using Windows.Foundation;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Media;

namespace bilibili2
Expand Down Expand Up @@ -162,6 +164,8 @@ public class VideoModel
public string page { get; set; }
public string from { get; set; }
public string part { get; set; }
public string rich_vid { get; set; }
public string vid { get; set; }
//番剧信息
public object season { get; set; }
public string season_id { get; set; }
Expand Down Expand Up @@ -566,6 +570,38 @@ public string LV
}
}
}
public RichTextBlock text
{
get
{
if (message != null)
{
string input = message;
input = input.Replace("\r\n", "<LineBreak/>");
input = input.Replace("\n", "<LineBreak/>");
MatchCollection mc = Regex.Matches(input, @"\[(.*?)\]");
foreach (Match item in mc)
{

input = input.Replace(item.Groups[0].Value, string.Format(@"<InlineUIContainer><Border><Image Source=""{0}"" Width=""36"" Height=""36""/></Border></InlineUIContainer>", ApiHelper.emojis.First(x => x.name == item.Groups[0].Value).url));
}

//生成xaml
var xaml = string.Format(@"<RichTextBlock HorizontalAlignment=""Stretch"" TextWrapping=""Wrap"" Margin=""5"" xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" xmlns:d=""http://schemas.microsoft.com/expression/blend/2008""
xmlns:mc = ""http://schemas.openxmlformats.org/markup-compatibility/2006"" >
<Paragraph>{0}</Paragraph>
</RichTextBlock>", input);
var p = (RichTextBlock)XamlReader.Load(xaml);
return p;
}
else
{
return null;
}
}

}
}
//视频相关
public class RecommendModel
Expand Down Expand Up @@ -600,6 +636,10 @@ public string expires
//用户信息
public class GetLoginInfoModel
{
public GetLoginInfoModel data { get; set; }
public GetLoginInfoModel card { get; set; }


public string mid { get; set; }//ID
public string name { get; set; }//昵称
public string sex { get; set; }//性别
Expand Down Expand Up @@ -1480,6 +1520,29 @@ public class VideoUriModel
public object backup_url { get; set; }//视频备份地址
}

public class SohuModel
{
public int status { get; set; }
public string statusText { get; set; }
public SohuModel data { get; set; }
public string url_blue { get; set; }

public string download_url { get; set; }
public string url_high { get; set; }
public string url_nor { get; set; }
public string url_original { get; set; }
public string url_super { get; set; }

public string url_high_mp4 { get; set; }
public string url_nor_mp4 { get; set; }
public string url_original_mp4 { get; set; }
public string url_super_mp4 { get; set; }
}
public class QQModel
{

}

public class HomeLiveModel
{
public int code { get; set; }
Expand Down
31 changes: 30 additions & 1 deletion bilibili2/Class/WebClientClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,36 @@ public async Task<string> GetResults(Uri url)
using (HttpClient hc = new HttpClient(fiter))
{

hc.DefaultRequestHeaders.Add("user-agent", "BiliBili Win10 Client/2.0 ([email protected])");
//hc.DefaultRequestHeaders.Add("user-agent", "BiliBili Win10 Client/2.0 ([email protected])");
HttpResponseMessage hr = await hc.GetAsync(url);
hr.EnsureSuccessStatusCode();
string results = await hr.Content.ReadAsStringAsync();

//HttpResponseMessage hr = await hc.GetAsync(url);
//hr.EnsureSuccessStatusCode();
//var encodeResults = await hr.Content.ReadAsBufferAsync();
//string results = Encoding.UTF8.GetString(encodeResults.ToArray(), 0, encodeResults.ToArray().Length);

return results;
}


}
public async Task<string> GetResults_Phone(Uri url)
{

HttpBaseProtocolFilter fiter = new HttpBaseProtocolFilter();
fiter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.Expired);
// fiter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.InvalidName);
// fiter.IgnorableServerCertificateErrors.Add(Windows.Security.Cryptography.Certificates.ChainValidationResult.UnknownCriticalExtension);
// myClientHandler.ClientCertificateOptions = System.Net.Http.ClientCertificateOption.Automatic;
// myClientHandler.AllowAutoRedirect = true;
//fiter.ServerCredential.
using (HttpClient hc = new HttpClient(fiter))
{

hc.DefaultRequestHeaders.Add("user-agent", "Bilibili Windows.Desktop Client/1.1.8.0 ([email protected])");
hc.DefaultRequestHeaders.Add("Referer", "http://interface.bilibili.com/");
HttpResponseMessage hr = await hc.GetAsync(url);
hr.EnsureSuccessStatusCode();
string results = await hr.Content.ReadAsStringAsync();
Expand Down
Loading

0 comments on commit 892bb57

Please sign in to comment.