jsoup connect function doesnt fetch html code - android

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.

Related

Any way to get entire web page from SDK by API call?

I Have one SDK (android). Is there any way to get entire webpage (HTML javascript whole page) by making API call?
There are many ways to get URL of webpage. I dont want URL I want full HTML of webpage directly so that I can use that in mobile app.
Is it possible? If it is then how? and If it is not then why not?
Any type of help appreciated.
If you have the URL of the page, the API is called HTTP GET and you only request the page with that URL - that will give you all the HTML that is on the page, including all the embedding tags that refer to external javascript, css, images etc.

How can I parse webpage content in 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?

Extracting image from html in Android

I am able to parse html content using HTMLCleaner & able to populate in list view. But extracting image I ma facing problem. while I am able to get images from any web server, i am not able to get same from my local Apache http server.
I want to know the reason & possible solution.
Thanks in advance.
It seems like the phone (emulator?) doesn't have access to your local server.
Use the browser in the phone/emulator and try to access your server just to make sure if it's this problem.
If you have access, print the url and make sure everything is alright.

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

Read HTML file from Website and convert into App

I am looking into developing an App that will convert a website into more readable data for an android app. I am at university and have an online notice board which can be viewed on the web but if possible I would like to transfer this into an app on android to make it more easy to read on mobile devices.
What I thinking is that the app would go to the website where the notice board is held and read in the html code to display each notice in a list adapter view. Each notice is within its own div so I assume I could use that to split each notice up into its own button on the list adapter view. Is this possible and if so how I can go about doing this. I have tried google for an answer but I have not yet found a solution to this problem.
Thanks for your help
It seems overly complicated to me. I wouldn't handle all that using Android. I'd crawl the data on a machine (server) and then I'd convert all needed data to JSON and have the Android (client) fetch the data using a simple JSON parser.
In my opinion that would be the easiest solution if you don't have access to the server the website is hosted on to get it generate a JSON feed for you directly.
EDIT: In answer to your comment Boardy.
Here is the official website of the JSON project in order to get an understanding of what it is. Then if you have access to the webserver providing that page (I assume it is a PHP based site) and want to modify or add the functionality of providing a JSON feed then you should also take a look at the PHP JSON documentation.
To parse JSON on Android check out this SO question and also don't forget to take a look at the official Android documentation on their JSON implementation.

Categories

Resources