LoginSignup
2
2

More than 5 years have passed since last update.

Python初心者がJSONでiTunesのランキングを取ってくるだけのものをつくってみた

Last updated at Posted at 2016-12-15

勉強用にランキング情報取ってきてただ表示するだけのものを作成してみました。
Python初めて書いたので…
エラー関係がさっぱりわかんなくて苦労した…

import json
import urllib.request

url = urllib.request.urlopen('https://itunes.apple.com/jp/rss/topfreeapplications/limit=10/json')
ranking = url.read()

encodeing= url.info().get_content_charset('utf-8')
jsonDecodeing = json.loads(ranking.decode(encodeing))
i=0
for kind in jsonDecodeing['feed']['entry']:
    i+=1
    print ( i, kind['title']['label'])

ということで実行結果はこんな感じ・・・

1 Super Mario Run - Nintendo Co., Ltd.
2 Goat Simulator - Coffee Stain Studios
3 Coke ON コカ·コーラの自販機がおトクに楽しくなるアプリ - Coca-Cola
4 Lep's World 3 無料 - スーパー最高のプラットフォーマーゲーム - nerByte GmbH
5 当たる占い師【水晶玉子】◆あなただけの特別鑑定書≪無料占いあり≫ - pocke, Inc
6 実況パワフルサッカー - KONAMI
7 スノー SNOW - 自撮り、顔認識スタンプ、ウケるカメラ - CampMobile Inc.
8 脱出ゲーム サンタの部屋 - Tatsuya Kishi
9 STAR OCEAN -anamnesis- - SQUARE ENIX INC
10 民放公式テレビポータル「TVer(ティーバー)」 - PRESENTCAST INC.

大したことはやってないけど・・・

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2