locked
[UWP]Getting live data from website on UWP RRS feed

  • Question

  • Hello, please some experts guide me how can I get data from website on UWP. To be more clear let me explain.

    MY CONCEPT: I designed a XAML that contains 1 text box 1 text block and 1 button. I put the URL that I want to get contents from in TextBox. When I press Button through ClickEvent, the contents of website like Title and body content, must be displayed on TextBlock excluding banners, comments,website navigations buttons etc displaying only content.

    MY TRY SO FAR: Most far I tried HttpClientHandler and the result is here attached on picture.

    ADDITIONAL IDEA: So, when something like article updates on website that must be updated on APP too, just like real data that news apps like MSN News,Windows Central etc, does.

    PROGRAMMING LANGUAGE: C#, UWP(Windows 10).

    MY RESEARCH: Certain api like DIFFBOT is an example to justify my question


    • Moved by Sabah ShariqMVP Tuesday, February 21, 2017 12:43 PM Moved From Visual C#
    • Edited by Xavier Xie-MSFT Wednesday, February 22, 2017 5:49 AM title tag
    Tuesday, February 21, 2017 12:38 PM

All replies

  • Hi Nischal,

    I am moving your thread to UWP forum for getting quick response.

    Your understanding and cooperation will be grateful.

    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Tuesday, February 21, 2017 12:43 PM
  • ok thanks for info
    Tuesday, February 21, 2017 12:44 PM
  • Hello Nischal Prajapati,

    I’ve checked your original post. I’m actually not sure what your question is. Did you want to know how to get data from website? Or did you want to know how to update the content in your app when the website updates its content?


    In addition, Welcome to the Developing Universal Windows apps forum!

    Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools  

    I've helped you add tag to title this time, please remember to add tag yourself next time.

    Best Regards,

    Xavier Eoro


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 22, 2017 6:01 AM
  • Both getting data from website and then how to update too. Two questions in single question, my original post is unclear so, I'm reposting to clarify more.
    Wednesday, February 22, 2017 6:03 AM
  • Hello Nischal Prajapati

    If you want to get data from website, you could use httpclient class to do it.

    Please check HttpClient sample for details.

    About update data, you could use DispatcherTimer to update it in an interval. 

    Best Regards,

    Xavier Eoro


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Sunday, February 26, 2017 8:08 AM
  • nope HttpClient didn't worked for me either, it displays like this.

    But I want to display only contents and title inside the body.
    Sunday, February 26, 2017 1:50 PM
  • Hello Nischal Prajapati,

    >>” But I want to display only contents and title inside the body.”

    The HttpClient class just is used to get the whole page content. If you want to get the specific html tag ‘s content, you would have to do it manually.

    You could think about using regular expressions. Or using some third-party library should be easy. Since the third-party is out of scope for this forum, I could only tell you to use your favorite search tools to search the keyword “HTML parser in uwp”. Then you will find some useful threads and code samples. 

    Best Regards,

    Xavier Eoro


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, February 27, 2017 2:27 AM
  • can you suggest me third party library?
    Also, I heard windows central and news sites fetch news from http://feeds.feedburner.com/wmexperts which is RSS way.

    Can I achieve my goal using RSS thing, I used this code from https://code.msdn.microsoft.com/windowsapps/How-to-perform-RSS-Reader-4803093b but it only gave title of RSS from that site but I want content and title in structured way.

    Monday, February 27, 2017 7:48 AM
  • 1. Install HtmlAgilityPack via Nuget

    2. After download string content of website, put it to HtmlDocument

    var doc = new HtmlDocument();

    doc.LoadHtml(html); // html is string content of that website

    3. Title of page is in <title> tag. So you need to get HtmlNode of title

    var titleNode = doc.DocumentNode.Descendants("title").First();

    var result = titleNode.InnerText.Trim(); // <= this is result you need

    Monday, February 27, 2017 8:49 AM
  • could you be a bit clear sir? in my case the url is userinput in textbox which is string page=value.text.
    Tuesday, March 7, 2017 4:50 AM
  • S
    Sadly, these error occurred while executing as per your code.
    Tuesday, March 7, 2017 5:05 AM