// End: GetMusicBrainzID private static string GetHTMLFromUrl(string url) { logger.Debug("Sending the request: " + url); try { mvWebGrabber grabber = Utility.GetWebGrabberInstance(url); grabber.Encoding = System.Text.Encoding.UTF8; grabber.Timeout = 5000; grabber.TimeoutIncrement = 10; if (grabber.GetResponse()) { return(grabber.GetString()); } } catch (Exception ex) { logger.Debug("GetHTMLFromUrl: ERROR: " + ex); } return(null); }
// given a url, retrieves the xml result set and returns the nodelist of Item objects private static XmlDocument getXML(string url) { XmlDocument xmldoc = new XmlDocument(); logger.Debug("Sending the request: " + url.Replace("eadfb84ac56eddbf072efbfc18a90845", "<apiKey>")); mvWebGrabber grabber = Utility.GetWebGrabberInstance(url); grabber.Encoding = Encoding.UTF8; grabber.Timeout = 5000; grabber.TimeoutIncrement = 10; grabber.Method = "POST"; if (grabber.GetResponse()) { return(grabber.GetXMLDoc()); } else { logger.Debug("***** API ERROR *****: Code:{0} ({1})", grabber.errorCode, grabber.errorText); return(null); } }
/// <summary> /// Get a WebGrabber instance with the default moving pictures settings /// </summary> /// <param name="url">url to resource</param> /// <returns>webgrabber instance</returns> public static mvWebGrabber GetWebGrabberInstance(string url) { mvWebGrabber grabber = new mvWebGrabber(url); grabber.UserAgent = "mvCentral/" + Assembly.GetExecutingAssembly().GetName().Version.ToString(); grabber.MaxRetries = mvCentralCore.Settings.MaxTimeouts; grabber.Timeout = mvCentralCore.Settings.TimeoutLength; grabber.TimeoutIncrement = mvCentralCore.Settings.TimeoutIncrement; return grabber; }