Facebook like link data extractor - facebook

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/

Related

Send the user to a page along with a error message

I want to set up a login page in which from anywhere on the site I can send a user to it and it will display a custom message along with it. I could use a redirect and a msg query param but is this the best way to do it?
I'm working with node.js but I'm interested in a universal solution.
If you are going for easy, you can just have GET data in the URL. But, that doesn't look that nice, if you want a rather long message, plus, GET has size restrictions, where POST (virtually) hasn't.
For using post data you could use the solution of this: JavaScript post request like a form submit question, but that gives a rather messy source code (if you want a somewhat longer text).
You could keep them in a database, and only send the ID of the message to a PHP page, and get it from the database (that's what I would do, but that doesn't mean it's a good idea, just amateur here!)
You can use jQuery or simply plain javascript to extract your message from the url; the relevant question that listed links to detailed code: jquery get querystring from URL.
Then depending on how you want it displayed, apply the extracted string to your situation.

Wikipedia page parser for iPhone App project

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.

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.

Write to Pastie or Pastebin?

I have an application I'm writing, in Objective-C(iPhone), and I want to be able to write a string of text to Pastie or Pastebin, and be able to have the link to that page. I have not been able to find any API for either of these, is this possible? How?
Thanks!
You will have to construct a HTTP POST request with the fields as described in the <form> tag on the html page.
for pastebin.com it would probably be parent_pid, format, code2 and poster.
Just make sure that the owner of the site doesn't have any problems with your program accessing it this way.
This is their API for pastebin.com: http://pastebin.com/api

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.