diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1bd60cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +venv +.git diff --git a/helper_scripts/TPD_Keys/TPD_Keys_CDRM_Bot.py b/helper_scripts/TPD_Keys/TPD_Keys_CDRM_Bot.py index 0c8286b..55b6d3d 100644 --- a/helper_scripts/TPD_Keys/TPD_Keys_CDRM_Bot.py +++ b/helper_scripts/TPD_Keys/TPD_Keys_CDRM_Bot.py @@ -77,7 +77,10 @@ def decrypt_content(pssh: str = None, license_url: str = None, licence = licence.content # parse license challenge - cdm.parse_license(session_id, licence) + try: + cdm.parse_license(session_id, licence) + except Exception as error: + return error # assign variable for returned keys returned_keys = "" @@ -90,10 +93,3 @@ def decrypt_content(pssh: str = None, license_url: str = None, return returned_keys - -def key_test(): - keys = decrypt_content( - pssh="AAAAW3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADsIARIQ62dqu8s0Xpa7z2FmMPGj2hoNd2lkZXZpbmVfdGVzdCIQZmtqM2xqYVNkZmFsa3IzaioCSEQyAA==", - license_url="https://cwip-shaka-proxy.appspot.com/no_auth", - service_certificate=True) - return keys diff --git a/helper_scripts/anime_api/waifu_pics.py b/helper_scripts/anime_api/waifu_pics.py index 2b90374..4e530a3 100644 --- a/helper_scripts/anime_api/waifu_pics.py +++ b/helper_scripts/anime_api/waifu_pics.py @@ -8,9 +8,3 @@ def get_image(): image = image.json()["url"] return image - -# Define get NSFW image -def get_image_nsfw(): - image = requests.get(url="https://api.waifu.pics/nsfw/waifu") - image = image.json()["url"] - return image diff --git a/main.py b/main.py index 4e6f965..017d24d 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,6 @@ # Import dependencies import os - import interactions - from helper_scripts import TPD_Keys from helper_scripts import DB_Cache from helper_scripts import anime_api @@ -66,8 +64,9 @@ DB_Cache.create_database.create_database() opt_type=OptionType.STRING, ) async def decrypt(ctx: SlashContext, pssh: str, license_url: str, - auth_bearer: str = None, x_dt_auth: str = None): - keys = TPD_Keys.decrypt_content(pssh=pssh, license_url=license_url, auth_token=auth_bearer, xdt_auth_token=x_dt_auth) + auth_bearer: str = None, x_dt_auth: str = None): + keys = TPD_Keys.decrypt_content(pssh=pssh, license_url=license_url, auth_token=auth_bearer, + xdt_auth_token=x_dt_auth) if keys != "Unable to retrieve service certificate" and keys != "Could not complete license challenge" and keys != "Invalid PSSH": DB_Cache.cache_key.cache_keys(pssh=pssh, keys=keys) embed = interactions.Embed(title="uWu") @@ -121,16 +120,4 @@ async def upload_database(ctx: SlashContext): await message.edit(content="Finished!", embeds=embed) -# Defining uwu command -@slash_command( - name="uwu", - description="Send a NSFW image to #stuff-you-wouldnt-post-on-general" -) -async def uwu(ctx: SlashContext): - channel = await bot.fetch_channel(1123340072322863124, force=True) - embed = interactions.Embed(title="uWu") - embed.set_image(url=f"{anime_api.waifu_pics.get_image_nsfw()}") - uwu = await channel.send(embed=embed) - await ctx.send(f"Posted in #{uwu.channel.name}", ephemeral=True) - bot.start(token=discord_bot_token)