예제 #1
0
        public Page Download(Uri url, WebConnectorJobConfiguration config)
        {
            var responseObject = _downloadHandler.Download(url, config, config.Credential.ToNetworkCredential());

            var pageHandler = _pageHandlers.FirstOrDefault(x => x.CanHandle(responseObject));

            return(pageHandler == null
                ? new IgnoredPage(url.ToString(), $"No Page handler registered that supports {responseObject}")
                : pageHandler.Extract(responseObject));
        }
예제 #2
0
        private ActionResult <string> Version1(string type, APIDownloadRequestViewModel model)
        {
            bool isVideo = type.ToLower() == "video";

            try
            {
                string filePath;
                string status;

                bool success = dlHandler.Download(isVideo, model.DownloadURL, model.CallSource, out filePath, out status);

                string responseURL = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}{filePath}"; // current domain + relative path.
                return(new JsonResult(new Data.DownloadResponse(success, responseURL, status)));
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }