Wikipedia page parser for iPhone App project - iphone

i want parse a wikipedia page to retrieve information for my ios app, there is a parser or some tutorial that explain me how i can do it?...or to put the page in an xml format, i have look the http://www.mediawiki.org/wiki/MediaWiki page, but i haven't understood nothing, if anyone can help me please..maybe with some example...

Have you read the MediaWiki API page, the page that describes the Query action, and above all else their API FAQ? These links will tell you what URLs you should be using to get the data that you require.
Do you know how to download a URL with NSURLConnection?
To start with, try using their API to download a Wikipedia page of your choice in HTML format. There's an answer in their FAQ that tells you how to request HTML format. If you do that, you'll get something you could display in a web view and style as you'd like.

Related

how to get news full content from rss feed in j2ee

I am developing a site which is supposed to get the news content of other sites, something like this. but without redirecting to the host for reading the news content.
now the problem is that I don't know what is the best way to get the content completely. I know that I can use RSS feed for each site but it has only a short description of each news not the whole story. I have also read the related questions in SO like these:
How to get the full content from the rss feed in javascript
How to extract the full content from a partial content rss
but none of them solved my problem .
now I wanna ask what is the best way to get the whole content of news from different sites if it is necessary to go directly to them?
I am sorry because of bad english and if my question is not clear enough I can explain it even more
thanks in advance
You could use web scraping library like boilerpipe to extract content from news sites, but scraping breaks easily(if the target site changes layout for example) and there might be legal issues in extracting full content from other sites and displaying in yours.
Edit: I tried boilerpipe api demo and the library seems very smart at extracting articles from web pages.

Get full-text articles from RSS Feed

Hello I am using GDataXML to parse RSS Feeds.
However most of todays feeds doesn't show the full text article. So most of the times I end up with just a tiny piece of the whole thing.
I see this feature in a lot of iPhone and iPad readers - it kinda fetches the article from the web and put it in full text.
So how do i do that?
My idea is this - the root element starts with the start of the article.
So if the root element have [article]
i need to go to the website, fetch the html code between the starting divs, and then display it in my app.
So how do i get the code between those divs? regular expressions or what? I want example thanks.
And finally how do i display images after I get the full article in html format?
Thanks guys and regards.
use MWFeedParser you will get RSS Feeds in
identifier, title, link, date, updated, summary, content, enclosures
I use MWFeedParser as well, because it will get all the elements of a feed entry, but you are correct that it will not do a "deep dive" into all of the links in the feed entry.
If you want to bring in the full content from the link, and the full content from the enclosures (such as audio or video from a podcast), you are basically talking about saving the web page for offline viewing. For a full html page, you would have to save that HTML, plus crawl the whole page and save the images, and change the path of those images so that you would be able to load it offline. It's not really the job of the RSS applications to save HTML content for offline use, but to get the elements of the RSS feed. Once you have all the links you want to save for offline use, you need to provide the code that will take a URL and save it offline.
I did a search for ios save html offline and found this post which seems pretty positive using ASIHttpRequest to save a page offline: https://stackoverflow.com/a/6698854/1072068. I would recommend you try using something like that once you get the parts of the rss feed entry from MWFeedParser.

Facebook like link data extractor

I'm seeking a lib that takes a URL and returns back useful information like:
Title
Description
List of images
Anything around?
Embed has a nice api for exactly this purpose. link
Try out the REST API links.preview method - https://developers.facebook.com/docs/reference/rest/links.preview/
You can also test out a few URLs to see if this is what you are looking for.
This one made my day: http://www.embedify.me/
Yes. You can send ajax request to a php file which gets contents of the url using file_get_contents() function and returns it to ajax. Then we can extract whatever we want from this data response.
For explanation, live demo and script download follow herehttp://www.voidtricks.com/extracting-url-data-like-facebook/

iPhone web services NSURL

hi I am working on an application which takes data from a website and it displays it in table. I have been sucessful in making like an RSS feed (made like a twitter feed so I think it is an xmlparser) but now I want to get data from a website which doesn't have RSS feed in it..I just want to get the titles from the webpage.... any suggestion how do I do it without the XMLParser...
thanks
I think that the best way is to create on your server a php/asp/... page that will scrape data from the remote website.
Then, in that page, you can use some CURL to scrape data.
See here.
Next, you return the data in the format you want (XML/jSon/etc...).
Finally, you can easily call that script from your code.
On the other hand, pay attention to not scrape anything as skimming is generally illegal and Apple ca reject your app because of that.
There is a nice post talking about it.

How does facebook's Share a link feature work?

I'm trying to implement a feature like that where a user inputs a url and when displaying that url I want to have a custom display (an embed object if it's a video from youtube, a thumbnail if it's an image link, title and excerpt of body if it's a normal link).
How can such a feature be realized?
There is a new idea called oEmbed that a few sites support (Flickr, Vimeo and a few others) that addresses this problem. oEmbed site
Otherwise, just check the site against a list of ones you pick and then pull out the relevant bits to construct an embed link.
I liked the idea of oEmbed a lot but unfortunately it doesn't has that much adoption yet.
oohEmbed tries to solve this issue by building oEmbed for many websites.
For the feature to work, it needs the server's interaction where I believe the following scenario is how it works
Assume that we have the site humanzz.com and that it provides such feature
A user enters a url on the humanzz.com's webpage and presses a button like facebooks' preview button
An AJAX call is made to a dedicated page on humanzz.com
humanzz.com does calls the remote website and gets its data
The AJAX call now returns the page's data (oEmbed JSON object)
This involves so much server's overhead.
I really wanted to do it using JavaScript as the server's role was only to bypass "Same Origin Policy"'s restrictions.
oohEmbed allows bypassing the server's step by specifying a callback parameter to oohEmbed so that the JSON object returned is passed to a callback function on your page.
An example illustrating this is as follows
Add a script tag dynamically to your page
< script type="text/javascript" src="http://oohembed.com/oohembed/?url=http%3A//www.amazon.com/Myths-Innovation-Scott-Berkun/dp/0596527055/&callback=myCallBack">< /script>
This would result in executing myCallback(oEmbedJSONObject) which is great.
The problem with that solution is you still have to have a fallback for websites that don't have oEmbed representations.
For the embedded things, I have been using auto_html ( https://github.com/dejan/auto_html) with great success (vimeo, youtube, images) and even added soundcloud myself. But I am still looking for a "thumbnail" generation with an image and text facebook-like.
I guess you have to construct it by yourself by manually parsing the kind of URL you get.
If it is an image url, well then you just have to rescale it and in case the user clicks on it, then handle that by opening the original one somehow.
If it is a link to some youtube video, then you have to take a look at how the embedding of Youtube videos works. You can just copy the code that is provided by Youtube itself, and then exchange the parts with the URL to the video with the URL you got from your user.
I did never implement something like that, but I assume it should work somehow like this.