Web Api to extract information from website
I need ki开发者_运维百科nd of service that extracts title from web page and returns in from of json. I would not like to parse web page or waste any unnecessary CPU cycles. ie call should be something like this:
curl http://api.someservice.com/fetch?url=google.com&element=title&out=json
Response from api would be:
{
response: {
title: "Google"
source: "google.com"
}
status: "success"
}
Any hint would be highly appreciated
You should have a look at YQL - it's a general-purpose service from Yahoo! that can do this kind of scraping really easily. Try this:
select * from html where url="google.com" and xpath='//title'
Test it here.
I suspect that Yahoo!'s YQL is probably pretty close to what you're looking for.
(In fact I think that a concise description of what YQL is would be, "a web API to extract information from a website" :-)
精彩评论