A script to enter the category ID with input and get up to 30th place in Rakuten ranking. A memorandum for playing around with it in the future.
rakuapi.py
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import requests
import sys, codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
gen_input = input("catID input here: ")
url = "https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927?"
st_load = {
"genreId": gen_input,
"applicationId": [your id],
}
r = requests.get(url, params=st_load)
res = r.json()
for i in res["Items"]:
item = i["Item"]
print u"Ranking: ",item["rank"],u"Rank"
print u"Product name: ",item["itemName"]
print u"URL: ",item["itemUrl"]
print u"price: ",item["itemPrice"], u"Circle", "\n"
Recommended Posts