43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using TYTD;
|
|||
|
using System.Net;
|
|||
|
using Newtonsoft.Json;
|
|||
|
|
|||
|
namespace ReturnYTDislikes
|
|||
|
{
|
|||
|
public class ReturnDislikes : Api
|
|||
|
{
|
|||
|
public override void OnStart()
|
|||
|
{
|
|||
|
|
|||
|
DownloadInfoStart += ReturnDislikes_DownloadInfoStart;
|
|||
|
}
|
|||
|
public override IEnumerable<KeyValuePair<string, string>> GetUrls()
|
|||
|
{
|
|||
|
return new List<KeyValuePair<string, string>>();
|
|||
|
|
|||
|
}
|
|||
|
private void ReturnDislikes_DownloadInfoStart(object sender, DownloadInfoStartEventArgs e)
|
|||
|
{
|
|||
|
using(var wc = new WebClient())
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
e.Video.Dislikes = JsonConvert.DeserializeObject<dislike>(wc.DownloadString($"https://returnyoutubedislikeapi.com/votes?videoId={e.Video.Id}")).dislikes;
|
|||
|
}catch(Exception ex)
|
|||
|
{
|
|||
|
_ = ex;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
public class dislike
|
|||
|
{
|
|||
|
public long dislikes { get; set; }
|
|||
|
}
|
|||
|
}
|
|||
|
}
|