如何从rss提要中提取图像通用Windows应用程序实时平铺

本文关键字:Windows 应用程序 实时 图像 提取 rss | 更新日期: 2023-09-27 18:26:52

我正在尝试从中添加图像http://bangla.bdnews24.com/?widgetName=rssfeed&小工具Id=1151&getXmlFeed=图像所在的真实urlcropimage标签。我目前正在使用以下代码行提取标题和摘要

 private static async Task<SyndicationFeed> GetMSDNBlogFeed()
    {
        SyndicationFeed feed = null;
        try
        {
            // Create a syndication client that downloads the feed.  
            SyndicationClient client = new SyndicationClient();
            client.BypassCacheOnRetrieve = true;
            client.SetRequestHeader(customHeaderName, customHeaderValue);
            // Download the feed. 
            feed = await client.RetrieveFeedAsync(new Uri(feedUrl));
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.ToString());
        }
        return feed;
    }
    private static void UpdateTile(SyndicationFeed feed)
    {
        // Create a tile update manager for the specified syndication feed.
        var updater = TileUpdateManager.CreateTileUpdaterForApplication();
        updater.EnableNotificationQueue(true);
        updater.Clear();
        // Keep track of the number feed items that get tile notifications. 
        int itemCount = 0;
        // Create a tile notification for each feed item.
        foreach (var item in feed.Items)
        {
            XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Text09);
            var title = item.Title;
            var summary = item.Summary;
            if (itemCount!=0)
            {
                string titleText = title.Text == null ? String.Empty : title.Text;
                string summaryText = summary.Text == null ? String.Empty : summary.Text;

                tileXml.GetElementsByTagName(textElementName)[0].InnerText = titleText;
                tileXml.GetElementsByTagName(textElementName)[1].InnerText = summaryText;
                // Create a new tile notification. 
                updater.Update(new TileNotification(tileXml));
            }
            // Don't create more than 5 notifications.
            if (itemCount++ > 7) break;
        }
    }
    // Although most HTTP servers do not require User-Agent header, others will reject the request or return 
    // a different response if this header is missing. Use SetRequestHeader() to add custom headers. 
    static string customHeaderName = "User-Agent";
    static string customHeaderValue = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)";
    static string textElementName = "text";
    static string feedUrl = @"http://bangla.bdnews24.com/?widgetName=rssfeed&widgetId=1151&getXmlFeed=true";

如何提取图像?提前感谢

如何从rss提要中提取图像通用Windows应用程序实时平铺

您必须使用XML解析器来获取数据。我建议使用LINQ to XML。