private string DownloadHtml(string url) { var webClient = new WebDownloader(120000); Byte[] pageData = webClient.DownloadData(url); return(Encoding.ASCII.GetString(pageData)); }
/// <summary> /// Get album's page /// </summary> /// <returns>Parsed album's page</returns> public AlbumResult GetFullAlbum() { WebDownloader downloader = new WebDownloader(AlbumUrl); string content = downloader.DownloadData(); return(WebContentParser.Parse <AlbumResult>(content)); }
/// <summary> /// Get band's page /// </summary> /// <returns>Parsed band's page</returns> public BandResult GetFullBand() { WebDownloader downloader = new WebDownloader(BandUrl); string content = downloader.DownloadData(); return(WebContentParser.Parse <BandResult>(content)); }
/// <summary> /// Gets list of band's albums simple list /// </summary> public IEnumerable <AlbumBandResult> GetAlbums(AlbumListType type) { WebDownloader wd = new WebDownloader($@"https://www.metal-archives.com/band/discography/id/{Id}/tab/" + type.ToString().ToLower()); string content = wd.DownloadData(); return(WebContentParser.ParseList <AlbumBandResult>(content)); }
/// <summary> /// Gets actual song's lyrics /// </summary> /// <returns>Lyrics or string.Empty if not exists</returns> public string GetLyrics() { string lyrics = string.Empty; if (HasLyrics) { WebDownloader wd = new WebDownloader($@"https://www.metal-archives.com/release/ajax-view-lyrics/id/{Id}"); HtmlDocument document = new HtmlDocument(); document.LoadHtml(wd.DownloadData()); lyrics = document.DocumentNode.InnerText.Trim(); } return(lyrics); }
/// <summary> /// If <see cref="NotesFullUrl"/> is not null, it returns full band's notes /// </summary> /// <returns>Band's notes</returns> public string GetFullNotes() { if (string.IsNullOrEmpty(NotesFullUrl)) { return(string.Empty); } WebDownloader downloader = new WebDownloader(NotesFullUrl); string content = downloader.DownloadData(); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(content); return(doc.DocumentNode.InnerText); }
/// <summary> /// Searches item by name. /// </summary> /// <param name="name">Item's name</param> /// <returns>List of items result - without pagination, all rows at once</returns> public IEnumerable <T> ByName(string name) { List <T> items = new List <T>(); _configurator.Parameters["query"] = name; var wd = new WebDownloader(_configurator.Url, _configurator.Parameters); IEnumerable <T> itemsToAdd; int page = 0; do { _configurator.Parameters["iDisplayStart"] = (page++ *200).ToString(); var response = wd.DownloadData(); itemsToAdd = ProcessParse(response); items.AddRange(itemsToAdd); }while (itemsToAdd.Count() != 0); return(items); }
public FileInfo DownloadSubtitle(string downloadLink, string fileName) { if (null == downloadLink) throw new ArgumentNullException(nameof(downloadLink)); string subtitleFile = Path.Combine(Path.GetTempPath(), fileName); string tempZipName = Path.GetTempFileName(); try { var webClient = new WebDownloader(); var data = webClient.DownloadData(downloadLink); using(var fileStream = new MemoryStream(data)) { UnzipSubtitleToFile(fileStream, subtitleFile); } } finally { File.Delete(tempZipName); } return new FileInfo(subtitleFile); }