public Task <IList <RSSItem> > RetrieveSyndicationItems() { IList <RSSItem> syndicationList = new List <RSSItem>(); var synd1 = new RSSItem() { Content = "Sample Content 1", PermaLink = new Uri("http://www.sampleaddress.com/sample-content-1"), LinkUri = new Uri("http://www.sampleaddress.com/sample-content-1"), LastUpdated = DateTime.Now, PublishDate = DateTime.Now, Title = "Sample Title 1", }; synd1.Categories.Add(".NET"); synd1.Authors.Add("*****@*****.**"); var synd2 = new RSSItem() { Content = "Sample Content 2", PermaLink = new Uri("http://www.sampleaddress.com/sample-content-2"), LinkUri = new Uri("http://www.sampleaddress.com/sample-content-2"), LastUpdated = DateTime.Now, PublishDate = DateTime.Now, Title = "Sample Title 2", }; synd2.Categories.Add(".NET"); synd2.Authors.Add("*****@*****.**"); syndicationList.Add(synd1); syndicationList.Add(synd2); return(Task.FromResult(syndicationList)); }
// ref: Building a Windows 8 RSS Reader // http://visualstudiomagazine.com/articles/2012/01/04/building-a-windows-8-rss-reader.aspx /// <summary> /// RSS 주소에서 피드 가져오기. /// </summary> /// <param name="url"></param> /// <param name="maxItems"></param> /// <returns></returns> public async Task<RSSFeed> GetFeeds(string url, int maxItems = 10) { var feeds = new RSSFeed(); var client = new SyndicationClient(); var feedUri = new Uri(url); SyndicationFeed feed = await client.RetrieveFeedAsync(feedUri); var topFeeds = feed.Items.OrderByDescending(x => x.PublishedDate).Take(maxItems).ToList(); feeds.Title = feed.Title.Text; foreach (var item in topFeeds) { var feedItem = new RSSItem { Title = item.Title.Text, PublishedOn = item.PublishedDate.DateTime }; var authors = from a in item.Authors select a.Name; feedItem.Author = String.Join(",", authors); feedItem.Content = item.Content != null ? item.Content.Text : String.Empty; feedItem.Description = item.Summary != null ? item.Summary.Text : String.Empty; var links = from l in item.Links select new RSSLink(l.Title, l.Uri); feedItem.Links = links.ToList(); feeds.Items.Add(feedItem); } return feeds; }
public static List <RSSItem> ParseRSS(string url) { List <RSSItem> RSSItems = new List <RSSItem>(); try { string RSSXML = GetPageContent(url); XmlDocument rss = new XmlDocument(); rss.LoadXml(RSSXML); XmlNodeList nodes = rss.DocumentElement.SelectNodes("/rss/channel/item"); foreach (XmlNode node in nodes) { string title = node.SelectSingleNode("title").InnerText; string link = node.SelectSingleNode("link").InnerText; string pubDate = node.SelectSingleNode("pubDate").InnerText; RSSItem item = new RSSItem { Title = title, Link = link, PubDate = pubDate }; RSSItems.Add(item); } } catch (Exception e) { Console.WriteLine(e.Message); } return(RSSItems); }
public void RSSDownload(RSSItem item) { GUIDialogYesNo dlg = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); dlg.SetHeading("Download this torrent?"); dlg.SetLine(1, item.Title); dlg.DoModal(GUIWindowManager.ActiveWindow); if (!dlg.IsConfirmed) { return; } TorrentLabel label = DialogAskLabel.Ask(); if (label != null) { bool ok = TorrentEngine.Instance().StartDownloading(item.Link, label.Name, true, "", "0", "", ""); if (!ok) { GUIDialogNotify notify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); notify.Reset(); notify.SetHeading("Failed!"); notify.SetText("Unable to start download."); notify.DoModal(GUIWindowManager.ActiveWindow); } } }
private void Page_Load(object sender, System.EventArgs e) { //System.Text.StringBuilder sb = new System.Text.StringBuilder(256); System.Data.SqlClient.SqlDataReader dr; RSSFeed rssFeed = new RSSFeed("AdamKinney's Blog", "http://www.adamkinney.com/blog/", "GotDotNet Bard"); rssFeed.ImplementsSlash = true; rssFeed.Language = "en-us"; rssFeed.ManagingEditor = "*****@*****.**"; rssFeed.WebMaster = "*****@*****.**"; rssFeed.TTL = "60"; // dr = Set dr to SQLDataReader that selects posts from database. RSSItem item; while (dr.Read()) { item = new RSSItem(dr[1].ToString(), "<![CDATA[ " + dr[2].ToString() + " ]]>"); item.Author = "Adam Kinney"; item.Categories.Add(new RSSCategory(dr[3].ToString())); item.Comments = "http://www.adamkinney.com/blog/default.aspx?PostID=" + dr[0].ToString() + "#comments"; item.Slash.Comments = dr[5].ToString(); item.Guid = "http://www.adamkinney.com/blog/default.aspx?PostID=" + dr[0].ToString(); item.GuidIsPermalink = true; item.PubDate = DateTime.Parse(dr[4].ToString()).ToString("r"); item.SourceUrl = "http://www.adamkinney.com/blog/rss.aspx"; rssFeed.Items.Add(item); } Response.ContentType = "text/xml"; Response.Write(rssFeed.ToString()); }
private void DownloadTorrent(RSSItem rssItem, string label) { bool started = TorrentEngine.Instance().StartDownloading(rssItem.Link, label, false, "", "0", "", ""); if (!started) { Log.Instance().Print(string.Format("Could not start downloading {0}.", rssItem.Link)); } }
public Episode(MainWindow mainWindow, RSSItem rssItem, int id) { // Set Variables this.mainWindow = mainWindow; this.rssItem = rssItem; BtnName = "dlep" + id.ToString(); AddEpisodeButton(); }
public override float GetHeightForRow(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { RSSItem rssItem = RSSItemList[indexPath.Row]; float textHeight = HeightOfText(CodeProjectRssFeedViewModel.StripHTML(rssItem.Description), 267); float height = RoundValueToNearestMultiple(textHeight, 18.5f) + 50; return(height); }
public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell("RSSItemCell"); RSSItem rssItem = RSSItemList[indexPath.Row]; (cell.ViewWithTag(titleTag) as UILabel).Text = rssItem.Title; (cell.ViewWithTag(authorTag) as UILabel).Text = rssItem.Author; (cell.ViewWithTag(descriptionTag) as UILabel).Text = CodeProjectRssFeedViewModel.StripHTML(rssItem.Description); return(cell); }
public PodcstItem(RSSItem podcastItem) { podcastEpisode = podcastItem; InitializeComponent(); lbTitle.Text = podcastEpisode.Title; wbDescription.DocumentText = podcastEpisode.Description; this.Show(); }
public Task <IList <RSSItem> > RetrieveSyndicationItems() { IList <RSSItem> syndicationList = new List <RSSItem>(); var synd1 = new RSSItem("Sample Title 1", "Sample Content 1") { PermaLink = new Uri("http://www.sampleaddress.com/sample-content-1"), LinkUri = new Uri("http://www.sampleaddress.com/sample-content-1"), LastUpdated = DateTime.Now, PublishDate = DateTime.Now, Categories = new List <string> { ".NET" }, Authors = new List <string> { "*****@*****.**" } }; var synd2 = new RSSItem(null, "Sample Content 2") { PermaLink = new Uri("http://www.sampleaddress.com/sample-content-2"), LinkUri = new Uri("http://www.sampleaddress.com/sample-content-2"), LastUpdated = DateTime.Now, PublishDate = DateTime.Now, Categories = new List <string> { ".NET" } }; var synd3 = new RSSItem("Sample Title 3", null) { PermaLink = new Uri("http://www.sampleaddress.com/sample-content-3"), LinkUri = new Uri("http://www.sampleaddress.com/sample-content-3"), LastUpdated = DateTime.Now, PublishDate = DateTime.Now, Authors = new List <string> { "*****@*****.**" } }; var synd4 = new RSSItem("Sample Title 4", null) { PermaLink = new Uri("http://www.sampleaddress.com/sample-content-4"), LinkUri = new Uri("http://www.sampleaddress.com/sample-content-4"), LastUpdated = DateTime.Now, PublishDate = DateTime.Now }; syndicationList.Add(synd1); syndicationList.Add(synd2); syndicationList.Add(synd3); syndicationList.Add(synd4); return(Task.FromResult(syndicationList)); }
private RSSItem RSSItemFromSyndicationItem(SyndicationItem item) { RSSItem output = new RSSItem(); output.Title = item.Title.Text; output.Description = item.Summary.Text; output.PublisedDate = item.PublishDate.DateTime; //todo: playURL output.PlayURL = item.Links[1].Uri; return(output); }
private void cleanUpScriptsEmbedded(RSSItem item) { //Clean up scripts in the item string desc = item.Description; // strip any dangerous code. if (desc.Contains("NcodeImageResizer.createOn(this);")) { desc = desc.Replace("NcodeImageResizer.createOn(this);", ""); item.Description = desc; } }
/// <summary> /// Fired whenever search text has changed. Filters RSSItems /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SearchTextChanged(object sender, TextChangedEventArgs e) { TextBox searchBox = (TextBox)sender; ItemsView.View.Filter = i => { if (i == null) { return(true); } RSSItem item = (RSSItem)i; return(item.Title.ToLower().Contains(searchBox.Text.ToLower())); }; }
private void checkSyndicationContentNode(RSSItem rssItem, SyndicationItem item) { if (item.Content == null) { try { if (item.ElementExtensions.Count > 0) { rssItem.Description = item.ElementExtensions.ReadElementExtensions <string>("encoded", "http://purl.org/rss/1.0/modules/content/")[0]; } } catch { } } }
public static IList <RSSItem> GetRss() { var item = new RSSItem { Pubdate = DateTime.Now, Title = "Getting started Uno", Description = "Setting up your development environment Prerequisites Windows 10 1809" }; var rssies = new List <RSSItem>(); for (int i = 0; i < 10; i++) { rssies.Add(item); } return(rssies); }
public static ISyndicationItem ToSyndicationItem(this RSSItem rssItem) { if (rssItem == null) { throw new ArgumentException(nameof(rssItem)); } //Should probably have an item title if (string.IsNullOrEmpty(rssItem.Title)) { throw new ArgumentNullException(nameof(rssItem.Title)); } //And some content if (string.IsNullOrEmpty(rssItem.Content)) { throw new ArgumentNullException(nameof(rssItem.Content)); } var syndicationItem = new SyndicationItem { Title = rssItem.Title, Description = rssItem.Content }; if (rssItem.PermaLink != null) { syndicationItem.AddLink(new SyndicationLink(rssItem.PermaLink, RssLinkTypes.Guid)); } if (rssItem.LinkUri != null) { syndicationItem.AddLink(new SyndicationLink(rssItem.LinkUri)); } if (rssItem.CommentsUri != null) { syndicationItem.AddLink(new SyndicationLink(rssItem.CommentsUri, RssLinkTypes.Comments)); } rssItem.Authors.ForEach(author => syndicationItem.AddContributor(new SyndicationPerson(null, author))); rssItem.Categories.ForEach(category => syndicationItem.AddCategory(new SyndicationCategory(category))); syndicationItem.Published = rssItem.PublishDate; return(syndicationItem); }
/// <summary> /// Item selected, go to ItemPage /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ItemSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 1) { RSSItem item = (RSSItem)e.AddedItems[0]; RSSService.SelectedItem = item; ListBox listBox = (sender as ListBox); int selected = listBox.SelectedIndex; if (selected != App.NO_SELECTION) { // Deselect the selected item listBox.SelectedIndex = App.NO_SELECTION; NavigationService.Navigate(new Uri("/Views/ItemPage.xaml?item=" + selected.ToString() + "&feed=" + feedId.ToString() + "&page=" + pageId.ToString(), UriKind.Relative)); } } }
/// <summary> /// Overridden OnNavigatedTo handler /// </summary> protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (isNewInstance) { if (State.ContainsKey("CurrentItem")) { item = (RSSItem)State["CurrentItem"]; } else { item = RSSService.SelectedItem; } isNewInstance = false; } }
public ActionResult TinTucRSS() { List <RSSItem> rssItemList = new List <RSSItem>(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(ConfigurationManager.AppSettings["RssUrl"]); XmlElement channel = xmlDoc["rss"]["channel"]; XmlNodeList itemList = channel.GetElementsByTagName("item"); foreach (XmlNode item in itemList) { var rssItem = new RSSItem(); rssItem.Title = item["title"].InnerText; rssItem.Description = item["description"].InnerText; rssItem.Link = item["link"].InnerText; rssItem.PubDate = Convert.ToDateTime(item["pubDate"].InnerText); rssItemList.Add(rssItem); } return(PartialView(rssItemList.OrderByDescending(d => d.PubDate).Take(10))); }
public RSSReader(string url) { XmlDocument doc = new XmlDocument(); doc.Load(url); XmlElement channel = doc["rss"]["channel"]; XmlNodeList items = channel.GetElementsByTagName("item"); this.title = channel["title"].InnerText; this.link = channel["link"].InnerText; this.description = channel["description"].InnerText; foreach (XmlNode item in items) { RSSItem rssItem = new RSSItem(); rssItem.title = item["title"].InnerText; rssItem.description = item["description"].InnerText; rssItem.link = item["link"].InnerText; this.items.Add(rssItem); } }
public async Task <IList <RSSItem> > RetrieveSyndicationItems() { var articles = await _context.Articles.OrderByDescending(a => a.Published).Take(10).ToListAsync(); return(articles.Select(rssItem => { var absoluteURL = new Uri(baseURL, $"/{rssItem.Slug}"); var wikiItem = new RSSItem { Content = rssItem.Content, PermaLink = absoluteURL, LinkUri = absoluteURL, PublishDate = rssItem.Published.ToDateTimeUtc(), LastUpdated = rssItem.Published.ToDateTimeUtc(), Title = rssItem.Topic, }; wikiItem.Authors.Add("Jeff Fritz"); // TODO: Grab from user who saved record... not this guy return wikiItem; }).ToList()); }
public static ISyndicationItem ToSyndicationItem(this RSSItem rssItem) { if (rssItem == null) { throw new ArgumentException(nameof(rssItem)); } var syndicationItem = new SyndicationItem { Title = rssItem.Title, Description = rssItem.Content }; if (rssItem.PermaLink != null) { syndicationItem.AddLink(new SyndicationLink(rssItem.PermaLink, RssLinkTypes.Guid)); } if (rssItem.LinkUri != null) { syndicationItem.AddLink(new SyndicationLink(rssItem.LinkUri)); } if (rssItem.CommentsUri != null) { syndicationItem.AddLink(new SyndicationLink(rssItem.CommentsUri, RssLinkTypes.Comments)); } if (rssItem.Authors != null) { rssItem.Authors.ForEach(author => syndicationItem.AddContributor(new SyndicationPerson(null, author))); } if (rssItem.Categories != null) { rssItem.Categories.ForEach(category => syndicationItem.AddCategory(new SyndicationCategory(category))); } syndicationItem.Published = rssItem.PublishDate; return(syndicationItem); }
public async Task <IList <RSSItem> > RetrieveSyndicationItems() { var articles = await this.context .Articles .OrderByDescending(a => a.Published) .Take(10) .ToListAsync(); return(articles.Select(rssItem => { var wikiItem = new RSSItem { Title = rssItem.Topic, Content = rssItem.Content, PermaLink = new Uri($"{this.Configuration["UrlDetails"]}{rssItem.Slug}", UriKind.Absolute), LinkUri = new Uri($"{this.Configuration["UrlDetails"]}{rssItem.Slug}", UriKind.Absolute), PublishDate = rssItem.PublishedOn, LastUpdated = rssItem.PublishedOn }; return wikiItem; }).ToList()); }
public void OnRSSAction(MediaPortal.GUI.Library.Action action) { if (action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU) { if (_selectedRSSChannel != null) { _selectedRSSChannel = null; //UpdateListItems(); return; } else { return; } } else if ((action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_DOWN) || (action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_MOVE_UP)) { RSSItem item = rss.AlbumInfoTag as RSSItem; if (item != null) { string description = Regex.Replace(item.Description, "<(.|\n)*?>", ""); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Source", item.Source); GUIPropertyManager.SetProperty("#MyTorrents.RSS.PublishDate", item.PublishDate.ToShortDateString() + " " + item.PublishDate.ToShortTimeString()); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Guid", item.Guid); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Enclosure", item.Enclosure); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Commments", item.Commments); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Category", item.Category); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Author", item.Author); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Description", description); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Link", item.Link); GUIPropertyManager.SetProperty("#MyTorrents.RSS.Title", item.Title); } } }
public FeedItemViewModel(RSSItem item) { this.Title = item.Title; this.Link = item.Link; this.PublicationDate = item.PublicationDate; }
public RSSReader(string url) { XmlTextReader reader = new XmlTextReader(url); while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "title": this.title = reader.ReadString(); break; case "link": this.link = reader.ReadString(); break; case "description": this.description = reader.ReadString(); break; case "image": while (!((reader.Name == "image") && (reader.NodeType == XmlNodeType.EndElement)) && reader.Read()) { } break; } } if (reader.Name == "item") { RSSItem item = new RSSItem(); while (!((reader.Name == "item") && (reader.NodeType == XmlNodeType.EndElement)) && reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name.ToLower()) { case "title": item.title = reader.ReadString(); break; case "description": item.description = reader.ReadString(); break; case "link": item.link = reader.ReadString(); break; } } } items.Add(item); } } }
/// <summary> /// Adds a new item to the channel /// </summary> /// <param name="newItem">an RSSItem to be added to the Channel</param> public void addItem(ref RSSItem newItem) { items.Add(newItem); }
public void Remove(RSSItem item) { List.Remove(item); }
public Regex(string keywords, RSSItem info, string[] contents) : base(keywords, info, contents) { }
public StringMatcher(string keywords, RSSItem info, string[] contents) { Keywords = keywords.ToLower(); Information = info; Contents = contents; }
public CodeProjectRssItemViewModel(RSSItem item /*, Action<string> gotoPageAction*/) { //this.GotoPageCommand = new ButtonCommandBinding<string>(NavigateToLink); this.item = item; Link = new Uri(item.Link, UriKind.Absolute); }
/// <summary> /// Add new a RSSItem to collection. /// </summary> /// <param name="item"></param> /// <returns></returns> public int Add(RSSItem item) { return(List.Add(item)); }
public int Add(RSSItem item) { return(List.Add(item)); }
/// <summary> /// Remove a RSSItem from collection. /// </summary> /// <param name="item"></param> public void Remove(RSSItem item) { List.Remove(item); }
public ActionRSS(RSSItem rss, string toWhereNoExt, ProcessedEpisode pe) { this.Episode = pe; this.RSS = rss; this.TheFileNoExt = toWhereNoExt; }
/// <summary> /// Add new a RSSItem to collection. /// </summary> /// <param name="title"></param> /// <returns></returns> public int Add(string title) { RSSItem oRSSItem = new RSSItem(title); return(Add(oRSSItem)); }
/// <summary> /// Add new a RSSItem to collection. /// </summary> /// <param name="title"></param> /// <param name="link"></param> /// <returns></returns> public int Add(string title, string link) { RSSItem oRSSItem = new RSSItem(title, link); return(Add(oRSSItem)); }