//This method returns the IDs of all Animes matching the query(animeName) public static List <string> GetAnimeIDs(string animeName) { //Creating List List <string> animeIDsList = new List <string>(); //creating the adress for our XmlRequest to receive the IDs string adress = BuildIDQueryAdress(animeName); //Getting the IDXmlDocument XmlDocument aniIDXmlDocument = HttpRequester.GetHttpXmlDocument(adress); //adding each ID to our IDList //this method returns an empty list if we have found no matches if (aniIDXmlDocument["animetitles"] == null || aniIDXmlDocument["animetitles"].ChildNodes.Count == 0) { return(animeIDsList); } //iterating over the entrys, extracting the aid foreach (XmlNode animeEntry in aniIDXmlDocument["animetitles"].ChildNodes) { if (animeEntry.Attributes != null && animeEntry.Attributes.GetNamedItem("aid") != null && animeEntry.Attributes.GetNamedItem("aid").Value != null) { animeIDsList.Add(animeEntry.Attributes.GetNamedItem("aid").Value); } } return(animeIDsList); }
// // Anime TimeSpan Handler // //This method querys AniDB and gets the TimeSpan to the next episode //Returns MaxTimeSpan if there is no episode //May return a negative Timespan if the end already aired public static Tuple <string, TimeSpan> GetNextEpisodeTimeSpan(string animeID) { //First we create the query Adress string adress = BuildAniDBQueryAdress(animeID); //We query the XMLDocument containing the airtimes XmlDocument aniDBEntry = HttpRequester.GetHttpXmlDocument(adress, DecompressionMethods.GZip); //AniDBEntry is null if we found no Entry if (aniDBEntry == null) { return(new Tuple <string, TimeSpan>("No entry", TimeSpan.MaxValue)); } //We get the Anime Name string animeName = GetAnimeName(aniDBEntry); //We get the Airtime of the next episode DateTime nextEpisodeDate = ExtractNextDate(aniDBEntry); //If there is no next episode DateTime is Maxvalue if (nextEpisodeDate == DateTime.MaxValue) { return(new Tuple <string, TimeSpan>(animeName, TimeSpan.MaxValue)); } //Calculating the Timespan to the Next Episode TimeSpan timeToNextEpisode = GetTimeUntilDateTime(nextEpisodeDate); return(new Tuple <string, TimeSpan>(animeName, timeToNextEpisode)); }
public static List <Tuple <string, string> > GetAnimeManga(string tag, AnimeManga tempAnimeManga) { string adress = AdressBuilder(tag, tempAnimeManga); XmlDocument baseXmlResponse = HttpRequester.GetHttpXmlDocument(adress, "HaruhiBot", "HaruhiBot123"); if (baseXmlResponse == null) { return(null); } return(GetAnimeMangaDictionary(tempAnimeManga, baseXmlResponse)); }