diff options
| author | Fuwn <[email protected]> | 2023-07-17 21:36:20 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-17 21:36:20 -0700 |
| commit | 7b5d9f5291143f6561f72557aed5c26ec1f294cb (patch) | |
| tree | de3ab5feb34486947819bf0ec837747705c71994 | |
| parent | docs(readme): add readme (diff) | |
| download | kaguya-7b5d9f5291143f6561f72557aed5c26ec1f294cb.tar.xz kaguya-7b5d9f5291143f6561f72557aed5c26ec1f294cb.zip | |
feat(x): implement social flag for mal
| -rw-r--r-- | src/x_command.sh | 10 |
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 |