mirror of
https://codeberg.org/ashley/poke.git
synced 2025-06-15 01:03:01 -04:00
owo
This commit is contained in:
parent
f431111611
commit
72143fede3
100 changed files with 12438 additions and 0 deletions
71
core/InnerTube/Models/YoutubeChannel.cs
Normal file
71
core/InnerTube/Models/YoutubeChannel.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using System.Xml;
|
||||
|
||||
namespace InnerTube.Models
|
||||
{
|
||||
public class YoutubeChannel
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
public string Url;
|
||||
public Thumbnail[] Avatars;
|
||||
public Thumbnail[] Banners;
|
||||
public string Description;
|
||||
public DynamicItem[] Videos;
|
||||
public string Subscribers;
|
||||
|
||||
public string GetHtmlDescription()
|
||||
{
|
||||
return Utils.GetHtmlDescription(Description);
|
||||
}
|
||||
|
||||
public XmlDocument GetXmlDocument()
|
||||
{
|
||||
XmlDocument doc = new();
|
||||
XmlElement channel = doc.CreateElement("Channel");
|
||||
channel.SetAttribute("id", Id);
|
||||
if (Id != Url)
|
||||
channel.SetAttribute("customUrl", Url);
|
||||
|
||||
XmlElement metadata = doc.CreateElement("Metadata");
|
||||
|
||||
XmlElement name = doc.CreateElement("Name");
|
||||
name.InnerText = Name;
|
||||
metadata.AppendChild(name);
|
||||
|
||||
XmlElement avatars = doc.CreateElement("Avatars");
|
||||
foreach (Thumbnail t in Avatars)
|
||||
{
|
||||
XmlElement thumbnail = doc.CreateElement("Thumbnail");
|
||||
thumbnail.SetAttribute("width", t.Width.ToString());
|
||||
thumbnail.SetAttribute("height", t.Height.ToString());
|
||||
thumbnail.InnerText = t.Url;
|
||||
avatars.AppendChild(thumbnail);
|
||||
}
|
||||
metadata.AppendChild(avatars);
|
||||
|
||||
XmlElement banners = doc.CreateElement("Banners");
|
||||
foreach (Thumbnail t in Banners)
|
||||
{
|
||||
XmlElement thumbnail = doc.CreateElement("Thumbnail");
|
||||
thumbnail.SetAttribute("width", t.Width.ToString());
|
||||
thumbnail.SetAttribute("height", t.Height.ToString());
|
||||
thumbnail.InnerText = t.Url;
|
||||
banners.AppendChild(thumbnail);
|
||||
}
|
||||
metadata.AppendChild(banners);
|
||||
|
||||
XmlElement subscriberCount = doc.CreateElement("Subscribers");
|
||||
subscriberCount.InnerText = Subscribers;
|
||||
metadata.AppendChild(subscriberCount);
|
||||
|
||||
channel.AppendChild(metadata);
|
||||
|
||||
XmlElement contents = doc.CreateElement("Contents");
|
||||
foreach (DynamicItem item in Videos) contents.AppendChild(item.GetXmlElement(doc));
|
||||
channel.AppendChild(contents);
|
||||
|
||||
doc.AppendChild(channel);
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue