开发者

Web Api to extract information from website

开发者 https://www.devze.com 2023-03-10 06:09 出处:网络
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.

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" :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消