0

In my android app, I have list of different blog URL, and I want to make google like card view.

I just want to know that how can I get info, like "Title", "Description", & "Image URL" etc. from the URL only.

Just like when I put some link in facebook or whatsapp they get the above information.

So how can I achieve it?

Shivam
  • 492
  • 5
  • 18
  • Download the content at the URL. Parse it using the appropriate parser for the MIME type (RSS, Atom, etc.). Collect your information from the parsed results. – CommonsWare Jan 06 '18 at 20:25

1 Answers1

1

You can get the web page title with this(This answer is copied from here):

You'll have to use a custom WebViewClient to get this done. You will override the onPageFinished() method so when a new page finishes loading you can set the webview to the appropriate title.

Below is a sample implementation of the above:

WebView mWebView = (WebView) findViewById(R.id.mwebview);
mWebView.setWebViewClient(new WebViewClient() {
    @Override
    public void onPageFinished(WebView view, String url) {
        ExperimentingActivity.this.setTitle(view.getTitle());
    }
});

But the description and image url is whole different story. Most webpages are different from each other and when you are getting a part of a webpage with a code, the code may be insufficient to work for another website. Yet, you can use a library like goose for parse a web page. What goose does is basically analyse a webpage and get the parts of that webpage that is most likely to be wanted.