質問

I am working on writing a keyword extractor in Python. I would like to use the Yahoo Content API. The question is, is there a Python2.7 (or even 3.x) wrapper for the Yahoo Content API? I could not find one doing normal searches.

In parallel, I am trying alchemyAPI, OpenCalais, DBPedia Spotlight. I would love to make a comparison to figure out which one to use in production.

Any guidance would be most appreciated.

Thanks

役に立ちましたか?

解決

I was interested in the answer as well. This is a possible solution:

import requests

text = """
Italian sculptors and painters of the renaissance favored the Virgin Mary for inspiration
"""

payload = {'q': "select * from contentanalysis.analyze where text='{text}'".format(text=text)}
r = requests.post("http://query.yahooapis.com/v1/public/yql", data=payload)
print(r.text)

他のヒント

According to the documentation, you can POST requests to the Yahoo content API and get JSON back. Python has the urllib2, requests and json libraries for that, all of which are well-documented and easy to use.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top