aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-07-17 21:36:20 -0700
committerFuwn <[email protected]>2023-07-17 21:36:20 -0700
commit7b5d9f5291143f6561f72557aed5c26ec1f294cb (patch)
treede3ab5feb34486947819bf0ec837747705c71994
parentdocs(readme): add readme (diff)
downloadkaguya-7b5d9f5291143f6561f72557aed5c26ec1f294cb.tar.xz
kaguya-7b5d9f5291143f6561f72557aed5c26ec1f294cb.zip
feat(x): implement social flag for mal
-rw-r--r--src/x_command.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/x_command.sh b/src/x_command.sh
index 25d1622..64a2814 100644
--- a/src/x_command.sh
+++ b/src/x_command.sh
@@ -30,7 +30,15 @@ ID=$(curl 'https://graphql.anilist.co/' \
# Open the anime or manga in AniList by default, permit MyAnimeList
if [ "${args[--mal]}" = 1 ]; then
- xdg-open https://myanimelist.net/${TYPE}/"$(echo "${ID}" | jq '.data.Media.idMal')"
+ if [ "${args[--social]}" = 1 ]; then
+ FULL_URL=$(curl --silent \
+ "https://api.jikan.moe/v4/anime/$(echo "${ID}" |
+ jq '.data.Media.idMal')/full")
+
+ xdg-open "$(echo "${FULL_URL}" | jq -r '.data.url')/forum"
+ else
+ xdg-open https://myanimelist.net/${TYPE}/"$(echo "${ID}" | jq '.data.Media.idMal')"
+ fi
else
if [ "${args[--social]}" = 1 ]; then
xdg-open https://anilist.co/${TYPE}/"$(echo "${ID}" | jq '.data.Media.id')"/social