public void AnimeVideosPage_ParsedCorrectly() { string testLink = "https://myanimelist.net/anime/5114/Fullmetal_Alchemist__Brotherhood/video"; VideosPageData page = MALParser.AnimePage.Videos.Parse(testLink); Assert.AreEqual(page.Promotions.Count, 2); }
public VideosPageData GetVideosPage() { if (m_videos != null) { return(m_videos); } if (m_header.Link_Videos == null) { throw new Exception("There's no videos page for this anime."); } m_videos = Videos.Parse(m_header.Link_Videos.Path); return(m_videos); }
public async Task <VideosPageData> GetVideosPageAsync() { if (m_videos != null) { return(m_videos); } if (m_header.Link_Videos == null) { throw new Exception("There's no videos page for this anime."); } m_videos = await Videos.ParseAsync(m_header.Link_Videos.Path); return(m_videos); }
private static VideosPageData AnalyzeDocument(string HTMLCode) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(HTMLCode); VideosPageData page = new VideosPageData(Header.AnalyzeHeader(HTMLCode)); try { foreach (var promo in doc.DocumentNode.Descendants("div").Where(x => x.GetAttributeValue("class", "") == "video-list-outer po-r pv")) { page.Promotions.Add(new LinkInfo(promo.Descendants("a").First().GetAttributeValue("href", ""))); } } catch (Exception ex) { Console.WriteLine(ex.Message + ex.StackTrace); } return(page); }