How can I parse webpage content in Android - android

I have a webpage that I know the contents of (standard look)
I am trying to parse the webpage in my android device so that I can extract certain information (say phone number). I have the URL.
How can I achieve this in Android? Any suggestion to how I can start or a quick example of doing so?
Thank you so much for the help

Try HTMLCleaner or TagSoup, for more information please check this example: http://blog.andrewpearson.org/2010/07/android-html-parsing.html
Also check out this StackOverflow question: What is the fastest way to scrape HTML webpage in Android?

Related

Getting wikipedia content page passing its title in Android

I'm developing an Android app that might use Wikipedia API to retrieve the content of a given page (from its title). I searched a lot in the web but I don't find useful information about the implementation. I read the MediaWiki documentation and I tried to format my requests in json format (example: request for "mountain" page content but the text isn't clear and I don't know how manage the request from my Android application.
So, my question is: how can I getting (clear) wikipedia page content by passing the title page from my application? And how to save the well format content in a String (that will corresponds with a TextView in a second moment)?
Anyone knows a good tutorial or can help me with some snippets?
Thank you very much indeed guys! :)
action=parse or action=mobileview or action=query&prop=extracts, depending on what exactly do you need. Use the API sandbox to interactively experiment with various requests, it has usage examples and shows how to build requests properly.

jsoup connect function doesnt fetch html code

I have implemented jsoup in android. Jsoup.connect() fetches the html content of a site "http://karnatakatourism.org/" correctly but it doesn't fetch anything for the url "http://karnatakatourism.org/Bidar/en/". I want to fetch the data from the links which are present in html page of www.karnatakatourism.org. Can anyone help me??
It seems that most of the content is loaded by some AJAX magic. You can try to analyze the network traffic to get to the URLs that you are really interested. These might be "getable" via JSoup.connect() then.
Another approach could be the use of other tools like selenium, but I don't know how far you can get with this on the android platform. Probably selendroid could provide your answer.

GrabURL from Website table

Hi Guys I Want to Grab an URL from a site the page only has one or many URL link on it, I would like to connect to the site URL and grab the link fro inside the page And put that in a string, Can It be done? I want to do it in android. Excuse me If this is a simple question Is that I really don't know how to do it, I have done researched but I am confused.
I want to grab this page
http://nightlies.videolan.org/build/win64/last/
It's Vlc, There are 6 Links and they are constantly updated, How can I get the urls and put them each on a string on My activity?, I want to fetch the links when the app is loaded so It gets the links as they are changing from day to day.
Thanks
You need an HTML Parser like JSoup: http://jsoup.org/.

In Andorid, is it possible to get the Embed Html code of a YouTube video link?

I'm little bit struggle on past few days i can't get good solution for regarding this. My task is to load the youtube link in an webview. The given url is VideoLink. I directly load this link through android webview it won't play. When i load the embed code of this link, it successfully loaded. Here my problem is i get the embed code Manually (ie load the url on system browser-> right click -> select copy embed html),but i have lot of links like this. Is it not possible to do manually. Is it possible to get the embed html code of youtube link by programmatically.
Why cant you create a httpConection to the URL and read the InputStream in to String and give it to Webview. if you can explain a bit more, i can suggest you a better idea.

xml parsing with no browser use

I have read the example for Rss Parsing from the ibm site.(http://www.ibm.com/developerworks/opensource/library/x-android/).
In this example,the rss are shown in a listview and then,if you press one announcement you can see it in the web browser of the device.How could i see them in the app,with no use of the device browser?
Thanks a lot
Create a layout with a WebView then load the URL from each "announcement" using WebView.loadUrl.
I'm a little confused but you seem to have answered your own question.
You say you don't want to use the web browser on the device but the example in your question doesn't use the browser. It does exactly what you're asking for.
The idea is that you download the html from the website and then use the parser to break it up into separate "announcements" and store them in list view items in your program.
I have done a bit of this type of thing myself in android. I used jsoup java library, which makes breaking the html into the bits you want to display really easy.
If you want some more help I can give you an example of an app I made that pulls movie times from google.com/movies as an example. here are links to the classes where I did the html download and parse:
ScreenScraper.java
HtmlParser.java

Categories

Resources