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:

10 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 ?