Search code examples
jsonrwebmining

R web/text mining - web query JSON read


In the Blekko search engine you can get the search results in JSON format, e.g. with the search term 'lifehacker':

http://blekko.com/ws/?q=lifehacker+%2Fjson

How could you carry out this query from R and parse the content? [There is a URL, a RSS URL and a snippet with the main text.]

I have tried packages tm.plugin.webmining and boilerpipeR, but couldn't figure it out.


Solution

  • Using Rcurl and RJSONIO packages is very handy to retrieve rjson results:

    library(RCurl)
    library(RJSONIO)
    doc <-  getURL('http://blekko.com/ws/?q=lifehacker+%2Fjson')
    doc.ll <- fromJSON(doc)
    

    Then you can check the result like this :

    doc.ll$RESULT