[PYTHON] Get ranking with Rakuten API

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.


# -*- 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

Get ranking with Rakuten API
Get information with zabbix api
Get reviews with python googlemap api
Golang api get
Get holidays with the Google Calendar API
[Python] Get Python package information with PyPI API
Get stock price data with Quandl API [Python]
Recent ranking creation using Qiita API with Python
Get Gmail subject and body with Python and Gmail API
Extrude with Fusion360 API
Get started with MicroPython
Get Tweets with Tweepy
Get date with python
Get started with Mezzanine
[First API] Try to get Qiita articles with Python
Get schedule from Garoon SOAP API with Python + Zeep
Get comments and subscribers with the YouTube Data API
[Python] Get user information and article information with Qiita API
Get tweets with arbitrary keywords using Twitter's Streaming API
YOLP Get map information XML file with Yahoo! Static Map API
Get country code with python
Image download with Flickr API
Get table dynamically with sqlalchemy
Use Trello API with python
Get started with Django! ~ Tutorial ⑤ ~
Create an API with Django
Get Twitter timeline with python
Get started with influxDB + Grafana
Use Twitter API with Python
API with Flask + uWSGI + Nginx
Get Youtube data with python
Get started with Django! ~ Tutorial ④ ~
Web API with Python + Falcon
Get thread ID with python
Get stock articles of infrastructure engineer yuta with Qiita API
Play RocketChat with API / Python
Get data from analytics API with Google API Client for python
Support yourself with Twitter API
Get started with Python! ~ ② Grammar ~
Get image features with OpenCV
Use subsonic API with python3
Get stock price with Python
Successful update_with_media with twitter API
Get Alembic information with Python
Qiita API Oauth with Django
Get another tab with pyppeteer
Get the number of PVs of Qiita articles you posted with API
Get conversions and revenue with Google Analytics API and report to Slack
Get Keyword Planner Search Volume / CPC / Competitiveness with Google Ads API
Operate Nutanix with REST API Part 2
Get video file information with ffmpeg-python
Get started with Python! ~ ① Environment construction ~
Get Salesforce data using REST API
Create Awaitable with Python / C API
Link to get started with python
Get negative reaction time with psychopy.event.getKeys ()
[AWS] Create API with API Gateway + Lambda
Get AWS account ID with boto3
Run Rotrics DexArm with python API
Specifying the date with the Twitter API
Get started with MicroPython (on macOS)