LoginSignup
3
5

More than 3 years have passed since last update.

Pythonを使ってAppStore、GooglePlayのランキングを取得

Posted at

Pythonを使ってAppStore、GooglePlayのランキングを取得

ランキング取得にはapptweakのAPIを使い取得
apptweakは独自の課金形態になっておりAPIごとに1〜のCreditsが発生する
無料で200/月Creditsがありテストであれば十分に使うことが可能だった

会員登録

apptweakサイトからSign Upから必要情報を入力し登録
スクリーンショット 2021-03-20 23.26.15.png

ダッシュボード

ダッシュボードから利用Creditsや利用リクエストを確認できる
スクリーンショット 2021-03-20 23.34.40.png

各API利用にはAPI Tokenが必要Profile & Settings | API Token から取得する
スクリーンショット 2021-03-20 23.41.44.png

各種API

ドキュメント一覧

ランキング

サンプルとしてApp Store ドランゴンクエストタクトのランキングを取得しリスト表示する

apptweak用のPythonパッケージが存在するのでインストール

$ pip install apptweak

サンプルコード

import apptweak


apptweak.API_KEY = "XTz"


def main():
    app_id = "1516559313"
    params = {"country": "jp", "start_date": "2021-03-01", "end_date": "2021-03-10", "device": "iphone"}
    json_response = apptweak.Ios.rankings(app_id, params)
    print(json_response)


if __name__ == '__main__':
    main()

レスポンス

{'content': {'ranks': {'6014': [53, 80, 106, 134, 151, 180, 184, 166, 178, 176], '0': [323, 499, 662, 800, 868, 851, 816, 830, 937, 931], '7014': [13, 16, 19, 28, 31, 36, 37, 32, 37, 41], '7015': [7, 11, 16, 20, 23, 31, 31, 28, 25, 32]}, 'max_fetched': {'0': [1492, 1494, 1493, 1492, 1493, 1493, 1492, 1492, 1493, 1492], '6014': [1500, 1499, 1499, 1500, 1500, 1500, 1500, 1500, 1500, 1500], '7014': [1500, 1500, 1500, 1499, 1500, 1500, 1500, 1500, 1500, 1499], '7015': [1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500]}, 'country': 'jp', 'device': 'iphone', 'type': 'free', 'start_date': '2021-03-01', 'end_date': '2021-03-10'}, 'metadata': {'request': {'path': '/applications/1516559313/rankings.json', 'store': 'ios', 'params': {'country': 'jp', 'start_date': '2021-03-01T00:00:00+00:00', 'end_date': '2021-03-10T00:00:00+00:00', 'device': 'iphone', 'id': '1516559313', 'format': 'json'}, 'performed_at': '2021-03-20 15:32:14 UTC'}, 'content': {}}}

他にもアプリデータや無料ランキングなど多くのデータを取得することができる


いいね!と思ったら LGTM お願いします :clap::clap::clap:

【PR】プログラミング新聞リリースしました! → https://pronichi.com
【PR】週末ハッカソンというイベントやってます! → https://weekend-hackathon.toyscreation.jp/about/

3
5
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
3
5