Skip to content

Commit 95a7b1e

Browse files
author
SD4RK
committed
Merge remote-tracking branch 'origin/master'
2 parents 32a509f + 74ed339 commit 95a7b1e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/free_games_example.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ def main() -> None:
1818
for game in free_games:
1919
game_title = game['title']
2020
game_publisher = game['seller']['name']
21-
game_url = f"https://store.epicgames.com/fr/p/{game['catalogNs']['mappings'][0]['pageSlug']}"
21+
22+
url_type = "bundles" if game['offerType'] == "BUNDLE" else "p"
23+
final_slug = game["catalogNs"]["mappings"][0]["pageSlug"] if game["catalogNs"]["mappings"] else game["urlSlug"]
24+
game_url = f"https://store.epicgames.com/fr/{url_type}/{final_slug}"
25+
2226
# Can be useful when you need to also show the thumbnail of the game.
2327
# Like in Discord's embeds for example, or anything else.
2428
# Here I showed it just as example and won't use it.

0 commit comments

Comments
 (0)