用于检索视频游戏数据的gamesdb.net api的python客户端。

gamesdb的Python项目详细描述


python游戏db

github:(https://github.com/jameserrico/python-gamesdb

python gamesdb是gamesdb.net api的python客户端 (http://wiki.thegamesdb.net/index.php?title=API_Introduction

目前,大多数但不是所有的api调用都受支持。检索大多数 图像还没有开发出来,但是对于 获取有关游戏和平台的数据。

安装

pip install gamesdb

先决条件

此包装的先决条件通常作为 基本python,不需要任何特殊安装。

  • urllib:已安装 默认情况下,大多数现代的python解释器都是这样。用于生成http 请求和读取响应。

用法

基础知识

为了使用这个库,你必须首先实例化一个gamesdb 反对。

fromgamesdb.apiimportAPIgamesdb_api=API()

特定呼叫

获取平台列表

GamesDB GetPlatformsList API Call

此调用不接受参数,并返回一个平台对象列表, 提供id、name和alias字段:

platform_list=gamesdb_api.get_platforms_list()forplatforminplatform_list:printplatform.id,"-",platform.name,"-",platform.alias

输出:

5 - 3DO - 3do
4911 - Amiga - amiga
4914 - Amstrad CPC - amstrad-cpc
4916 - Android - amstrad-cpc
23 - Arcade - arcade
22 - Atari 2600 - atari-2600
...

获取平台

GamesDB GetPlatform API Call

此调用检索平台的所有可用详细信息,基于 在get_platforms_list()中返回的ID。

atari_platform=gamesdb_api.get_platform('22')printatari_platform.nameprintatari_platform.overview

输出:

Atari 2600
The Atari 2600 is a video game console released in October 1977 by Atari, Inc. It is credited with popularizing the use of microprocessor-based hardware and cartridges containing game code, instead of having non-microprocessor dedicated hardware with all games built in. The first game console to use this format was the Fairchild Channel F; however, the Atari 2600 receives credit for making the plug-in concept popular among the game-playing public.
The console was originally sold as the Atari VCS, for Video Computer System. Following the release of the Atari 5200, in 1982, the VCS was renamed "Atari 2600", after the unit's Atari part number, CX2600. The 2600 was typically bundled with two joystick controllers, a conjoined pair of paddle controllers, and a cartridge game—initially Combat and later Pac-Man.

The Atari 2600 was wildly successful, and during much of the 1980s, "Atari" was a synonym for this model in mainstream media and, by extension, for video games in general.

获取平台游戏

GamesDB GetPlatformGames API Call

根据在中检索到的平台ID检索游戏列表 获取平台列表,包括ID、标题和(如果有的话)发布日期 密集的。注意,现在,发布日期回来了 基于api响应提供的内容的格式不一致。

atari_games_list=gamesdb_api.get_platform_games('22')# Atari 2600 Platform idforgameinatari_games_list:printgame.id,"-",game.title,"-",game.release_date

输出:

206 - Commando - None
207 - Dig Dug - 01/01/1982
10128 - H.E.R.O. - 01/01/1984
1292 - Ghostbusters - 1984
1341 - Amidar - 01/01/1982
1342 - Asteroids - 08/01/1979
1343 - Battlezone - 01/01/1983
1344 - Blackjack - 01/01/1977
1345 - Casino - None
1346 - Centipede - 01/01/1982
1347 - Defender - 01/01/1980
1348 - Gravitar - None
1349 - Indy 500 - 01/01/1977
1350 - Joust - None
...

获取游戏

GamesDB GetGame API Call

检索游戏或游戏列表的所有可用详细信息,基于 不在游戏ID或名称中。如果传入名称,您可以选择 按平台筛选结果。注意,当查询只返回一个 游戏(按ID查询时的情况)将返回一个游戏。什么时候? 您的查询返回多个项目,它将返回一个游戏列表。 当查询未返回任何结果时,将不返回任何结果。

注意,getgame将树名参数用空格作为or搜索 操作。例如,搜索name=“mega man”将返回所有 在游戏名称中包含“大”或“人”的游戏。这是 与getgameslist不同,getgameslist将相同的搜索视为 操作。

按ID获取游戏
game=gamesdb_api.get_game(id="1350")printgame.titleprintgame.overviewprintgame.genresprintgame.developer

输出:

Joust
Joust is a platforming game where the player controls a yellow knight riding a flying ostrich from a third-person perspective. The player navigates the protagonist around the game world, which consists of rock platforms floating above a flat island surrounded by lava.
Platform
Williams Electronics
按名称获取游戏
mega_man_games=gamesdb_api.get_game(name="mega man")forgameinmega_man_games:printgame.titleprintgame.platformprint"---------------------"

输出:

Mega Man
Nintendo Entertainment System (NES)
---------------------
Mega Man Zero
Nintendo Game Boy Advance
---------------------
Mega Man Soccer
Super Nintendo (SNES)
---------------------
Mega Man 3
Nintendo Game Boy
---------------------
Mega Man Xtreme
Nintendo Game Boy Color
---------------------
Mega Man X5
Sony Playstation
---------------------

...

Mega Bomberman
Sega Mega Drive
---------------------
Mega Turrican
Sega Genesis
---------------------
Mega Force
Atari 2600
---------------------
Mega Bomberman
Sega Genesis
---------------------
Low G Man: The Low Gravity Man
Nintendo Entertainment System (NES)
---------------------
Mega-Lo-Mania
Super Nintendo (SNES)
---------------------
WarioWare, Inc.: Mega Microgames!
Nintendo Game Boy Advance
---------------------
Sonic Mega Collection
Nintendo GameCube
---------------------
WarioWare, Inc.: Mega Party Games!
Nintendo GameCube
---------------------
Eight Man
NeoGeo
按名称和平台获取游戏
mega_man_games=gamesdb_api.get_game(name="mega man",platform='Nintendo Entertainment System (NES)')forgameinmega_man_games:printgame.titleprintgame.platformprint"---------------------"

输出:

Mega Man
Nintendo Entertainment System (NES)
---------------------
Mega Man 2
Nintendo Entertainment System (NES)
---------------------
Mega Man 5
Nintendo Entertainment System (NES)
---------------------
Mega Man 3
Nintendo Entertainment System (NES)
---------------------
Mega Man 4
Nintendo Entertainment System (NES)
---------------------
Mega Man 6
Nintendo Entertainment System (NES)
---------------------
Low G Man: The Low Gravity Man
Nintendo Entertainment System (NES)
---------------------
Pac-Man
Nintendo Entertainment System (NES)
---------------------
Ms. Pac-Man
Nintendo Entertainment System (NES)
---------------------
Spider-Man: Return of the Sinister Six
Nintendo Entertainment System (NES)
---------------------
Metal Mech: Man & Machine
Nintendo Entertainment System (NES)
---------------------
The Simpsons: Bartman Meets Radioactive Man
Nintendo Entertainment System (NES)
...

获取游戏列表

GamesDB GetGamesList API Call

检索 基于名称的游戏列表,以及可选的平台和 体裁。此呼叫将始终返回游戏列表。

注意,getgameslist将把带有空格的名称参数视为 搜索操作。例如,搜索name=“mega man”将 返回标题中同时包含“mega”和“man”的所有游戏。这个 与GetGame不同,后者将相同的搜索视为或 操作。

按名称获取游戏列表
mega_man_games=gamesdb_api.get_games_list(name="mega man")forgameinmega_man_games:printgame.titleprintgame.platformprintgame.release_dateprint"---------------------"

输出:

Mega Man
Nintendo Entertainment System (NES)
12/17/1987
---------------------
Mega Man Zero
Nintendo Game Boy Advance
04/26/2002
---------------------
Mega Man 5
Nintendo Entertainment System (NES)
12/04/1992
---------------------
Mega Man X
Super Nintendo (SNES)
01/01/1994
---------------------
Mega Man 7
Super Nintendo (SNES)
03/24/1995
---------------------
Mega Man 2
Nintendo Entertainment System (NES)
11/24/1988
---------------------
Mega Man 3
Nintendo Entertainment System (NES)
09/28/1990
---------------------
Mega Man 4
Nintendo Entertainment System (NES)
12/06/1991
---------------------
Mega Man 6
Nintendo Entertainment System (NES)
10/06/1992
---------------------
Mega Man 8
Sony Playstation
12/17/1996
---------------------
Mega Man Legends
Sony Playstation
08/31/1998
---------------------
Mega Man X4
Sony Playstation
08/10/1997
---------------------
Mega Man X2
Super Nintendo (SNES)
01/01/1995
---------------------
Mega Man X3
Super Nintendo (SNES)
01/01/1996
---------------------
Mega Man 64
Nintendo 64
11/22/2000
---------------------
Mega Man & Bass
Nintendo Game Boy Advance
08/10/2002
---------------------
Mega Man Zero 2
Nintendo Game Boy Advance
05/02/2003
---------------------
Mega Man Zero 3
Nintendo Game Boy Advance
04/23/2004
---------------------
Mega Man Zero 4
Nintendo Game Boy Advance
04/21/2005
---------------------
Mega Man X6
Sony Playstation
12/04/2001
---------------------
按名称和平台获取游戏列表
mega_man_games=gamesdb_api.get_games_list(name="mega man",platform='Sony Playstation')forgameinmega_man_games:printgame.titleprintgame.platformprintgame.release_dateprint"---------------------"

输出:

Mega Man 8
Sony Playstation
12/17/1996
---------------------
Mega Man Legends
Sony Playstation
08/31/1998
---------------------
Mega Man X4
Sony Playstation
08/10/1997
---------------------
Mega Man X6
Sony Playstation
12/04/2001
---------------------
Mega Man X5
Sony Playstation
01/31/2001
---------------------
Mega Man X3
Sony Playstation
04/26/1996
---------------------
Mega Man Battle & Chase
Sony Playstation
11/30/1998
---------------------
Mega Man Legends 2
Sony Playstation
10/24/2000
---------------------
Spider-Man
Sony Playstation
01/01/2001
---------------------
Shadow Man
Sony Playstation
09/30/1999
---------------------
Pac-Man World
Sony Playstation
01/01/2000
---------------------
Action Man: Operation Extreme
Sony Playstation
11/08/2000
---------------------
Pac-Man World 20th Aniversary
Sony Playstation
09/30/1999
---------------------
Ms. Pac-Man Maze Madness
Sony Playstation
09/08/2000
---------------------
Spider-Man 2: Enter Electro
Sony Playstation
08/16/2001
---------------------
Iron Man / X-O Manowar in Heavy Metal
Sony Playstation
10/31/1996
---------------------
按名称和类型获取游戏列表

注意,您可以独立地传入流派和平台,名称是 仅为必需字段。

mega_man_games=gamesdb_api.get_games_list(name="mega man",platform='Sony Playstation',genre='platform')forgameinmega_man_games:printgame.titleprintgame.platformprintgame.release_dateprint"---------------------"

输出:

Mega Man X6
Sony Playstation
12/04/2001
---------------------
Mega Man Legends 2
Sony Playstation
10/24/2000
---------------------
Pac-Man World 20th Aniversary
Sony Playstation
09/30/1999
---------------------

课程

目前,有两种主要的类类型用于显示结果。这个 popul的特定条目ATE将根据其他查询和 可用于对象的实际数据。

  • 游戏
  • id
  • 标题
  • 发布日期
  • 平台
  • 概述
  • ESRB U评级
  • 体裁
  • 玩家
  • 合作社
  • YouTube网址
  • 出版商
  • 显影剂
  • 评分
  • 徽标网址
  • 平台
  • id
  • 姓名
  • 别名
  • 控制台
  • 控制器
  • 概述
  • 显影剂
  • 制造商
  • CPU
  • 内存
  • 图形
  • 声音
  • 显示
  • 媒体
  • 最大控制器
  • 评分

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java我可以在J2EE1.4中使用JAXR吗   YouTube数据API超出了未经验证的java每日使用限制   java RED5 RTMPConnManager未设置applicationContext局部变量。这会导致NullPointerException   java多部分/formdata,加载图像(安卓)   java Struts 2<s:select>填充表单中的其他字段   java Eclipse在迁移后不会将邮件属性传递给Spring Boot   java如何检查请求的TLS版本   java如何从包中导入相同的类   如何在java中将BLOB字符串转换为人类可读的格式字符串   java使用Play映射特定的文件路径!框架   java Eclipse重构   在子字符串上使用“预定义字符类”的java   java如何在SeleniumWebDriver中选择li中的锚定标记?   jspjava。木卫一。FileNotFoundException:系统找不到指定的路径   java Hi,在启动cmd\design javafx\cmd eclipse时,我的文件不是删除的,也不是复制的   java Selenium Web驱动程序异常“找不到:taskkill的可执行文件”   java如何获得数组的迭代器?