CMorooney / obsidian-game-search-plugin

Obsidian plugin that automatically creates notes by searching for video games
MIT License
36 stars 10 forks source link

Can we get publisher added? #3

Closed B1GBOOM420 closed 1 year ago

B1GBOOM420 commented 1 year ago

The API already spits it out, so could we please get that added to the incoming information?

CMorooney commented 1 year ago

The API already spits it out, so could we please get that added to the incoming information?

Yup i am going to look into this and another request tonight/tomorrow, will update here

CMorooney commented 1 year ago

The API already spits it out, so could we please get that added to the incoming information?

actually @B1GBOOM420 -- can you help me find where you see the API providing that information? At the moment the plugin uses the search param on the games list GET endpoint

for instance, here is the result for Tears of the Kingdom

{
    "slug": "the-legend-of-zelda-breath-of-the-wild-sequel",
    "name": "The Legend of Zelda: Tears of the Kingdom",
    "playtime": 0,
    "platforms": [
        {
            "platform": {
                "id": 7,
                "name": "Nintendo Switch",
                "slug": "nintendo-switch"
            }
        }
    ],
    "stores": [
        {
            "store": {
                "id": 6,
                "name": "Nintendo Store",
                "slug": "nintendo"
            }
        }
    ],
    "released": "2023-05-12",
    "tba": false,
    "background_image": "https://media.rawg.io/media/games/556/55684bfd048706f4266d331d70050b37.jpg",
    "rating": 4.45,
    "rating_top": 5,
    "ratings": [
        {
            "id": 5,
            "title": "exceptional",
            "count": 64,
            "percent": 78.05
        },
        {
            "id": 1,
            "title": "skip",
            "count": 8,
            "percent": 9.76
        },
        {
            "id": 4,
            "title": "recommended",
            "count": 7,
            "percent": 8.54
        },
        {
            "id": 3,
            "title": "meh",
            "count": 3,
            "percent": 3.66
        }
    ],
    "ratings_count": 79,
    "reviews_text_count": 3,
    "added": 789,
    "added_by_status": {
        "yet": 79,
        "owned": 85,
        "beaten": 24,
        "toplay": 473,
        "dropped": 8,
        "playing": 120
    },
    "metacritic": 96,
    "suggestions_count": 463,
    "updated": "2023-06-10T23:27:32",
    "id": 327239,
    "score": "35.185223",
    "clip": null,
    "tags": [
        {
            "id": 31,
            "name": "Singleplayer",
            "slug": "singleplayer",
            "language": "eng",
            "games_count": 205673,
            "image_background": "https://media.rawg.io/media/games/34b/34b1f1850a1c06fd971bc6ab3ac0ce0e.jpg"
        },
        {
            "id": 24,
            "name": "RPG",
            "slug": "rpg",
            "language": "eng",
            "games_count": 17231,
            "image_background": "https://media.rawg.io/media/games/c24/c24ec439abf4a2e92f3429dfa83f7f94.jpg"
        },
        {
            "id": 36,
            "name": "Open World",
            "slug": "open-world",
            "language": "eng",
            "games_count": 6255,
            "image_background": "https://media.rawg.io/media/games/34b/34b1f1850a1c06fd971bc6ab3ac0ce0e.jpg"
        },
        {
            "id": 37,
            "name": "Sandbox",
            "slug": "sandbox",
            "language": "eng",
            "games_count": 5892,
            "image_background": "https://media.rawg.io/media/games/511/5118aff5091cb3efec399c808f8c598f.jpg"
        },
        {
            "id": 37796,
            "name": "exclusive",
            "slug": "exclusive",
            "language": "eng",
            "games_count": 4506,
            "image_background": "https://media.rawg.io/media/games/cd3/cd3c9c7d3e95cb1608fd6250f1b90b7a.jpg"
        },
        {
            "id": 425,
            "name": "Single player only",
            "slug": "single-player-only",
            "language": "eng",
            "games_count": 31,
            "image_background": "https://media.rawg.io/media/games/862/86283a28784f6a24d35b5bbb3ab3b4a8.jpg"
        },
        {
            "id": 867,
            "name": "zelda",
            "slug": "zelda",
            "language": "eng",
            "games_count": 493,
            "image_background": "https://media.rawg.io/media/games/087/08727beb32c364d30e8b2a1aa8595f8e.jpg"
        }
    ],
    "esrb_rating": {
        "id": 2,
        "name": "Everyone 10+",
        "slug": "everyone-10-plus",
        "name_en": "Everyone 10+",
        "name_ru": "С 10 лет"
    },
    "user_game": null,
    "reviews_count": 82,
    "saturated_color": "0f0f0f",
    "dominant_color": "0f0f0f",
    "short_screenshots": [
        {
            "id": -1,
            "image": "https://media.rawg.io/media/games/556/55684bfd048706f4266d331d70050b37.jpg"
        },
        {
            "id": 1961492,
            "image": "https://media.rawg.io/media/screenshots/51f/51f7928a2630fc4bbb3dac59b8f31448.jpg"
        },
        {
            "id": 1961493,
            "image": "https://media.rawg.io/media/screenshots/104/10431d15726ed2593401cc70e2115a82.jpg"
        },
        {
            "id": 1961494,
            "image": "https://media.rawg.io/media/screenshots/c0d/c0dafd15ec182acab8f5879665eaa642.jpg"
        },
        {
            "id": 1961495,
            "image": "https://media.rawg.io/media/screenshots/725/725dbbf72f15a32f418a42d2e8ac8b25.jpg"
        },
        {
            "id": 1961496,
            "image": "https://media.rawg.io/media/screenshots/c63/c63fda6df2574a7d071f96082438e820.jpg"
        },
        {
            "id": 2897101,
            "image": "https://media.rawg.io/media/screenshots/c92/c92c2acf519b3dc613c0f0085cc34b34.jpg"
        }
    ],
    "parent_platforms": [
        {
            "platform": {
                "id": 7,
                "name": "Nintendo",
                "slug": "nintendo"
            }
        }
    ],
    "genres": [
        {
            "id": 3,
            "name": "Adventure",
            "slug": "adventure"
        },
        {
            "id": 4,
            "name": "Action",
            "slug": "action"
        }
    ]
}

I don't see any Publisher information in that response, nor in the more specific game details endpoint

I do see that there is a Publisher portion of the API but there doesn't seem to be a way to tie a game to a publisher that I can see.

B1GBOOM420 commented 1 year ago

Currently, I'm away from my desk,

But when I was doing my initial use of the API, I got a response that included the publisher. ( using postman )

Hopefully, I will be home tomorrow, and then I can grab you the full response

( for reference - I looked up skyrim on search when I got my information)

B1GBOOM420 commented 1 year ago

@CMorooney sorry for the delay - using Postman, I got this back from the API - searching up the game you used as an example.

3 from the bottom in the JSON you can see "publishers"

also noticed, there is also a "developers" section as well

https://api.rawg.io/api/games/the-legend-of-zelda-breath-of-the-wild-sequel?key=myKey

{
    "id": 327239,
    "slug": "the-legend-of-zelda-breath-of-the-wild-sequel",
    "name": "The Legend of Zelda: Tears of the Kingdom",
    "name_original": "The Legend of Zelda: Tears of the Kingdom",
    "description": "<p>An epic adventure across the land and skies of Hyrule awaits in The Legend of Zelda™: Tears of the Kingdom for Nintendo Switch™. The adventure is yours to create in a world fueled by your imagination. In this sequel to The Legend of Zelda: Breath of the Wild, you’ll decide your own path through the sprawling landscapes of Hyrule and the mysterious islands floating in the vast skies above. Can you harness the power of Link’s new abilities to fight back against the malevolent forces that threaten the kingdom?</p>",
    "metacritic": 96,
    "metacritic_platforms": [
        {
            "metascore": 96,
            "url": "https://www.metacritic.com/game/switch/the-legend-of-zelda-tears-of-the-kingdom",
            "platform": {
                "platform": 7,
                "name": "Nintendo Switch",
                "slug": "nintendo-switch"
            }
        }
    ],
    "released": "2023-05-12",
    "tba": false,
    "updated": "2023-06-10T23:27:32",
    "background_image": "https://media.rawg.io/media/games/556/55684bfd048706f4266d331d70050b37.jpg",
    "background_image_additional": "https://media.rawg.io/media/screenshots/d21/d21c8a76a370cb681c8f5391d83b2296.jpg",
    "website": "",
    "rating": 4.45,
    "rating_top": 5,
    "ratings": [
        {
            "id": 5,
            "title": "exceptional",
            "count": 64,
            "percent": 78.05
        },
        {
            "id": 1,
            "title": "skip",
            "count": 8,
            "percent": 9.76
        },
        {
            "id": 4,
            "title": "recommended",
            "count": 7,
            "percent": 8.54
        },
        {
            "id": 3,
            "title": "meh",
            "count": 3,
            "percent": 3.66
        }
    ],
    "reactions": {
        "1": 1,
        "2": 1,
        "3": 1,
        "4": 1,
        "5": 1,
        "6": 1,
        "7": 1,
        "8": 1,
        "9": 1,
        "10": 1,
        "11": 1,
        "12": 1
    },
    "added": 791,
    "added_by_status": {
        "yet": 79,
        "owned": 86,
        "beaten": 24,
        "toplay": 473,
        "dropped": 8,
        "playing": 121
    },
    "playtime": 0,
    "screenshots_count": 26,
    "movies_count": 0,
    "creators_count": 2,
    "achievements_count": 0,
    "parent_achievements_count": 0,
    "reddit_url": "https://www.reddit.com/r/tearsofthekingdom/",
    "reddit_name": "The Legend of Zelda: Tears of the Kingdom",
    "reddit_description": "This Subreddit is dedicated to the video game, The Legend of Zelda: Tears of the Kingdom, on Nintendo Switch.",
    "reddit_logo": "",
    "reddit_count": 129,
    "twitch_count": 37,
    "youtube_count": 171148,
    "reviews_text_count": 3,
    "ratings_count": 79,
    "suggestions_count": 463,
    "alternative_names": [
        "The Legend of Zelda: Breath of the Wild (Sequel)"
    ],
    "metacritic_url": "https://www.metacritic.com/game/switch/the-legend-of-zelda-tears-of-the-kingdom",
    "parents_count": 0,
    "additions_count": 0,
    "game_series_count": 26,
    "user_game": null,
    "reviews_count": 82,
    "saturated_color": "0f0f0f",
    "dominant_color": "0f0f0f",
    "parent_platforms": [
        {
            "platform": {
                "id": 7,
                "name": "Nintendo",
                "slug": "nintendo"
            }
        }
    ],
    "platforms": [
        {
            "platform": {
                "id": 7,
                "name": "Nintendo Switch",
                "slug": "nintendo-switch",
                "image": null,
                "year_end": null,
                "year_start": null,
                "games_count": 5234,
                "image_background": "https://media.rawg.io/media/games/157/15742f2f67eacff546738e1ab5c19d20.jpg"
            },
            "released_at": "2023-05-12",
            "requirements": {}
        }
    ],
    "stores": [
        {
            "id": 954190,
            "url": "",
            "store": {
                "id": 6,
                "name": "Nintendo Store",
                "slug": "nintendo",
                "domain": "nintendo.com",
                "games_count": 8874,
                "image_background": "https://media.rawg.io/media/games/63f/63f0e68688cad279ed38cde931dbfcdb.jpg"
            }
        }
    ],
    "developers": [
        {
            "id": 16257,
            "name": "Nintendo",
            "slug": "nintendo",
            "games_count": 412,
            "image_background": "https://media.rawg.io/media/games/dd1/dd167cf8753db3748a975d61cc926e54.jpg"
        }
    ],
    "genres": [
        {
            "id": 4,
            "name": "Action",
            "slug": "action",
            "games_count": 172783,
            "image_background": "https://media.rawg.io/media/games/021/021c4e21a1824d2526f925eff6324653.jpg"
        },
        {
            "id": 3,
            "name": "Adventure",
            "slug": "adventure",
            "games_count": 132549,
            "image_background": "https://media.rawg.io/media/games/5c0/5c0dd63002cb23f804aab327d40ef119.jpg"
        }
    ],
    "tags": [
        {
            "id": 31,
            "name": "Singleplayer",
            "slug": "singleplayer",
            "language": "eng",
            "games_count": 205673,
            "image_background": "https://media.rawg.io/media/games/34b/34b1f1850a1c06fd971bc6ab3ac0ce0e.jpg"
        },
        {
            "id": 24,
            "name": "RPG",
            "slug": "rpg",
            "language": "eng",
            "games_count": 17231,
            "image_background": "https://media.rawg.io/media/games/c24/c24ec439abf4a2e92f3429dfa83f7f94.jpg"
        },
        {
            "id": 36,
            "name": "Open World",
            "slug": "open-world",
            "language": "eng",
            "games_count": 6255,
            "image_background": "https://media.rawg.io/media/games/34b/34b1f1850a1c06fd971bc6ab3ac0ce0e.jpg"
        },
        {
            "id": 37,
            "name": "Sandbox",
            "slug": "sandbox",
            "language": "eng",
            "games_count": 5892,
            "image_background": "https://media.rawg.io/media/games/511/5118aff5091cb3efec399c808f8c598f.jpg"
        },
        {
            "id": 37796,
            "name": "exclusive",
            "slug": "exclusive",
            "language": "eng",
            "games_count": 4506,
            "image_background": "https://media.rawg.io/media/games/cd3/cd3c9c7d3e95cb1608fd6250f1b90b7a.jpg"
        },
        {
            "id": 425,
            "name": "Single player only",
            "slug": "single-player-only",
            "language": "eng",
            "games_count": 31,
            "image_background": "https://media.rawg.io/media/games/862/86283a28784f6a24d35b5bbb3ab3b4a8.jpg"
        },
        {
            "id": 867,
            "name": "zelda",
            "slug": "zelda",
            "language": "eng",
            "games_count": 493,
            "image_background": "https://media.rawg.io/media/games/087/08727beb32c364d30e8b2a1aa8595f8e.jpg"
        }
    ],
    "publishers": [
        {
            "id": 10681,
            "name": "Nintendo",
            "slug": "nintendo",
            "games_count": 1213,
            "image_background": "https://media.rawg.io/media/games/bee/bee483efadcf9d7e657e52184316a34e.jpg"
        }
    ],
    "esrb_rating": {
        "id": 2,
        "name": "Everyone 10+",
        "slug": "everyone-10-plus"
    },
    "clip": null,
    "description_raw": "An epic adventure across the land and skies of Hyrule awaits in The Legend of Zelda™: Tears of the Kingdom for Nintendo Switch™. The adventure is yours to create in a world fueled by your imagination. In this sequel to The Legend of Zelda: Breath of the Wild, you’ll decide your own path through the sprawling landscapes of Hyrule and the mysterious islands floating in the vast skies above. Can you harness the power of Link’s new abilities to fight back against the malevolent forces that threaten the kingdom?"
}
B1GBOOM420 commented 1 year ago

Maybe it is possible to use the game search to hammer down what game specifically ( meaning for the search ) and then reach out for the API call to get all the information like shown above

not sure if its possible, just a thought :)

CMorooney commented 1 year ago

@B1GBOOM420 ah, looks like you're right! those fields aren't documented on the RAWG site that I can see, I should have tried them myself :] thanks for the example I'll try and get an update out today to do just what you suggest

B1GBOOM420 commented 1 year ago

@B1GBOOM420 ah, looks like you're right! those fields aren't documented on the RAWG site that I can see, I should have tried them myself :] thanks for the example I'll try and get an update out today to do just what you suggest

Thanks so much! Happy to have helped 😁

CMorooney commented 1 year ago

okay, 1.4 should allow you to use developers and publishers as variables in templates -- they will be printed as comma separated strings since they come back from the API as arrays.

https://github.com/CMorooney/obsidian-game-search-plugin/releases/tag/0.1.4