private void URLforDownload_TextChanged(object sender, EventArgs e) { isTedVideo = this.txURLforDownload.Text.StartsWith(this.tedBrowser1.urlForVideo); isEuronewsVideo = EuronewsProviderLoad.IsValidForDownloading(this.txURLforDownload.Text); isYouTube = YouTubeBrowser.IsValidForDownloading(this.txURLforDownload.Text); isAmara = AmaraBrowser.IsValidForDownloading(this.txURLforDownload.Text); this.btDownloadfromURL.Enabled = isTedVideo || isEuronewsVideo || isYouTube || isAmara; }
private void wbTedView_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (EuronewsProviderLoad.IsValidForDownloading(e.Url.AbsoluteUri)) { e.Cancel = true; CallRunDownload(e.Url.AbsoluteUri); } }
bool RunDownload(string url) { try { News newsFrom = null; News newsNative = null; EuronewsProviderLoad newsProvider = new EuronewsProviderLoad(); try { progressDownloadForm = new f.TED.FormDowloadedInfo(); progressDownloadForm.Show(); progressDownloadForm.EnSubtProgress = 10; newsFrom = newsProvider.GetContent(url); progressDownloadForm.EnSubtProgress = 60; progressDownloadForm.NativeSubtProgress = 10; string nativeSuffix = CurrentLangInfo.CurrentLangPair.To + "."; string nativeUrl = url.Replace("www.euronews.com", nativeSuffix + "euronews.com"); newsNative = newsProvider.GetContent(nativeUrl); if (newsFrom == null) { throw new ApplicationException("Was not found information fo detail data. Try another addres for getting data."); } progressDownloadForm.NativeSubtProgress = 60; string folder = GetFolder(newsFrom.Title, rootFolderName); DoDownloadFile(newsFrom.ImgSrc, folder); if (newsFrom != null) { DownloadNews(newsFrom, folder); } //if (this.newsNative != null && this.newsFrom != null) if (newsNative != null) { newsNative.VideoSrc = null; // skip native video DownloadNews(newsNative, folder, nativeSuffix, newsFrom == null ? newsNative : newsFrom); } return(true); } finally { progressDownloadForm.Close(); } } catch (TimeoutException) { MessageBox.Show("TimeoutException, please try again later"); return(false); } }
void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string url = e.Url.AbsoluteUri.Replace("localhost", "http://euronews.com"); if (EuronewsProviderLoad.IsValidForDownloading(url)) { (new EuronewsBrowser()).CallRunDownload(e.Url.AbsoluteUri); } if (e.Url.AbsoluteUri != "about:blank") { e.Cancel = true; } }