A script for Quickadd plugin to fetch video game data into your vault using IGDB!

ezgif.com-gif-maker

Based on the movies and series script proposed by @Christian, this script uses IGDB api to fetch data.

If anyone is interested, here is a link to the Github repo of this script, including a tutorial on how to install.

If the script helped you and you wish to support this work :wink: :

Please make sure you understand the script before using it, I’m not a programmer so use with caution !

Related script

If you enjoyed this script, you may also be interested by another script I made, to fetch books data into your vault:

9 Likes

Hey there!

Really cool Idea—I’ve been loving the movies and series script and I’m stoked to get cracking on this.

One issue: I’m getting the “Auth refresh error” message. Some inspection shows that my IGDB Token JSON file isn’t getting created by the script. I know you said you’re not a programmer, but it looks like this is a new/unique section of code compared to the movies and series script, so I wonder if you have any ideas why this could be happening?

I do wonder if there may be an issue with my setup of the Twitch App, if I had to hazard a guess. JSON/API connections are new to me and I was unable to find some clear documentation around Twitch→IGDB, so perhaps the JSON file isn’t being created because the token isn’t being generated in the first place?

If that’s the case, I’d love to see how you set up your redirect. In my case, I just went with the localhost (however I did try plugging in the url of actual v4/games endpoint and that didn’t work either).

Would love to hear your thoughts about what may be going on here!

Problem raised by @bearlythinking has been solved. Please make sure you don’t accidentally add a space when entering client id or client-secret in script configuration.

Added 1.1 :

  • Now possible to fetch developer name and logo (if available on IGDB).

If anyone had trouble getting IGDB client id and client secret needed to run this script, I added detailed steps in the readme on how to obtain them.

New in 1.5 :

  • igdbToken.json is now saved in Obsidian vault’s config directory and not in Obsidian’s system directory.
  • The script should now also run on Mac.

Update 2022-02-08 :

Work is being done to make this script also work on mobile. I need to find a way to use Obsidian API inside a Quickadd script, to replace node.js fs and normalize from path which apparently do not work on mobile.

New in 2.0 :

  • Script should now work on mobile, thanks to QuickAdd 0.5.1 !
  • Fixed a bug where a missing information from IGDB would prevent note creation.
1 Like

Hey, I’ve been trying to set up this script but I’m stuck on the part to set the client_id and client_secret, for me the cog for the script doesnt appear. You have any idea what could it be?

@CaoticHazard : Mmm, I can’t reproduce that issue on latest Obsidian version. Could you please post a screenshot ?

Here it is, it keeps saying that it’s undefined too, both the script and template

Have you properly followed steps 1. and 5. here ?

  1. Save the script to your vault somewhere. Make sure it is saved as a JavaScript file, meaning that it has the .js at the end.
  1. Add the user script to the command list.

I can see that in “User scripts”, no script is selected.

Yes, it’s saved on a scripts folder on my vault. When I select it and click on add it disappear from the User script field and becomes the undefined thing up top

Ok, in which folder is it stored and what is its name ?


digital_garden/30. Resources/Scripts

And what is the name of the script ?


igdb_macro.js

quickadd even picks it up. And just to show, that’s how it is before I click Add for the script

Can you try to put the script at the root of your vault (in digital_garden), and try again ?

Also, have you modified something in the script ?

Tried that just now, didn’t work. Also I didn’t change the script, just gave it a quick read before trying anything.

Letting the script in the root, can you try to rename it “script_videogames.js” and restart Obsidian ?