Fixed some GUI elements
This commit is contained in:
TPD94 2023-12-29 13:01:47 -05:00
parent f42123e269
commit f99f4be1ef
2 changed files with 77 additions and 30 deletions

View File

@ -16,53 +16,46 @@ def start_gui(wvd: str = None, api_key: str = None):
sg.theme('Dark Amber') # Add theme sg.theme('Dark Amber') # Add theme
# 1- the layout # the layout
left_frame_normal = sg.Col([ left_frame_normal = sg.Col([
[sg.Text('PSSH:'), sg.Text(size=(15, 1), key='-PSSH_TEXT-')], [sg.Text('PSSH:'), sg.Text(size=(15, 1), key='-PSSH_TEXT-', expand_x=True, expand_y=True)],
[sg.Input(key="-PSSH-")], [sg.Input(key="-PSSH-")],
[sg.Text(text='License URL:'), sg.Text(size=(15, 1), key='-LIC_URL_TEXT-')], [sg.Text(text='License URL:'), sg.Text(size=(15, 1), key='-LIC_URL_TEXT-', expand_x=True, expand_y=True)],
[sg.Input(key='-LIC_URL-')], [sg.Input(key='-LIC_URL-')],
[sg.Text('Keys:')], [sg.Text('Keys:')],
[sg.Output(size=(45, 6), key='-OUTPUT-')], [sg.Output(size=(45, 6), key='-OUTPUT-', expand_y=True, expand_x=True)],
[sg.Button('Decrypt'), sg.Button('Reset')] [sg.Button('Decrypt'), sg.Button('Reset')]
], p=0) ], expand_x=True, expand_y=True)
right_frame_normal = sg.Col([ right_frame_normal = sg.Col([
[sg.Text('Headers:')], [sg.Text('Headers:')],
[sg.Multiline(key='-HEADERS-', size=(50, 10))], [sg.Multiline(key='-HEADERS-', size=(50, 10), expand_x=True, expand_y=True)],
[sg.Text('JSON:', key='-JSON_TEXT-', visible=False)], [sg.Text('JSON:', key='-JSON_TEXT-', visible=False)],
[sg.Multiline(key='-JSON-', size=(50, 10), visible=False)], [sg.Multiline(key='-JSON-', size=(50, 10), visible=False, expand_x=True, expand_y=True)],
[sg.Text('Cookies:', key='-COOKIES_TEXT-', visible=False)], [sg.Text('Cookies:', key='-COOKIES_TEXT-', visible=False)],
[sg.Multiline(key='-COOKIES-', size=(50, 10), visible=False)], [sg.Multiline(key='-COOKIES-', size=(50, 10), visible=False, expand_x=True, expand_y=True)],
[sg.Combo(values=['Generic', 'Crunchyroll', 'YouTube'], default_value='Generic', key='-OPTIONS-', enable_events=True),sg.Push(), sg.Checkbox(text="Use CDM-Project API", key='-USE_API-')] [sg.Combo(values=['Generic', 'Crunchyroll', 'YouTube'], default_value='Generic', key='-OPTIONS-', enable_events=True), sg.Push(), sg.Checkbox(text="Use CDM-Project API", key='-USE_API-')]
], p=0) ], expand_x=True, expand_y=True)
window_layout = [ window_layout = [
[left_frame_normal, right_frame_normal] [left_frame_normal, right_frame_normal]
] ]
# 2 - the window # the window
window = sg.Window('TPD-Keys', layout=window_layout) window = sg.Window('TPD-Keys', layout=window_layout, resizable=True)
# 3 - the event loop # the event loop
while True: while True:
event, values = window.read() event, values = window.read()
# Action for window close event
if event == sg.WIN_CLOSED: if event == sg.WIN_CLOSED:
break break
# Action for Decrypt for Generic decrypt if fields are filled out
if event == 'Decrypt': if event == 'Decrypt':
if values['-PSSH-'] != '' and values['-LIC_URL-'] == '' and values['-OPTIONS-'] == 'Generic':
window['-OUTPUT-'].update(f"No License URL provided")
if values['-LIC_URL-'] != '' and values['-PSSH-'] == '' and values['-OPTIONS-'] == 'Generic':
window['-OUTPUT-'].update(f"No PSSH provided")
if values['-PSSH-'] == '' and values['-LIC_URL-'] == '' and values['-OPTIONS-'] == 'Generic':
window['-OUTPUT-'].update(f"No PSSH or License URL provided")
if values['-PSSH-'] != '' and values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'Generic': if values['-PSSH-'] != '' and values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'Generic':
if values['-HEADERS-'] == '': if values['-HEADERS-'] == '':
if not values['-USE_API-']: if not values['-USE_API-']:
@ -99,6 +92,19 @@ def start_gui(wvd: str = None, api_key: str = None):
except Exception as error: except Exception as error:
window['-OUTPUT-'].update(f"{error}") window['-OUTPUT-'].update(f"{error}")
# Error for no license URL - Generic
if values['-PSSH-'] != '' and values['-LIC_URL-'] == '' and values['-OPTIONS-'] == 'Generic':
window['-OUTPUT-'].update(f"No License URL provided")
# Error for no PSSH - Generic
if values['-LIC_URL-'] != '' and values['-PSSH-'] == '' and values['-OPTIONS-'] == 'Generic':
window['-OUTPUT-'].update(f"No PSSH provided")
# Error for no PSSH or License URL - Generic
if values['-PSSH-'] == '' and values['-LIC_URL-'] == '' and values['-OPTIONS-'] == 'Generic':
window['-OUTPUT-'].update(f"No PSSH or License URL provided")
# Action for Decrypt for Crunchyroll decrypt if fields are filled out
if values['-PSSH-'] != '' and values['-OPTIONS-'] == 'Crunchyroll' and values['-HEADERS-'] != '': if values['-PSSH-'] != '' and values['-OPTIONS-'] == 'Crunchyroll' and values['-HEADERS-'] != '':
if not values['-USE_API-']: if not values['-USE_API-']:
try: try:
@ -115,12 +121,15 @@ def start_gui(wvd: str = None, api_key: str = None):
except Exception as error: except Exception as error:
window['-OUTPUT-'].update(f"{error}") window['-OUTPUT-'].update(f"{error}")
# Error for no Headers - Generic
if values['-PSSH-'] != '' and values['-OPTIONS-'] == 'Crunchyroll' and values['-HEADERS-'] == '': if values['-PSSH-'] != '' and values['-OPTIONS-'] == 'Crunchyroll' and values['-HEADERS-'] == '':
window['-OUTPUT-'].update(f"No Headers provided") window['-OUTPUT-'].update(f"No Headers provided")
# Error for no PSSH
if values['-PSSH-'] == '' and values['-OPTIONS-'] == 'Crunchyroll': if values['-PSSH-'] == '' and values['-OPTIONS-'] == 'Crunchyroll':
window['-OUTPUT-'].update(f"No PSSH provided") window['-OUTPUT-'].update(f"No PSSH provided")
# Action for Decrypt for YouTube decrypt if fields are filled out
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] != '' and values['-JSON-'] != '' and values['-COOKIES-'] != '': if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] != '' and values['-JSON-'] != '' and values['-COOKIES-'] != '':
if not values['-USE_API-']: if not values['-USE_API-']:
try: try:
@ -141,45 +150,82 @@ def start_gui(wvd: str = None, api_key: str = None):
except Exception as error: except Exception as error:
window['-OUTPUT-'].update(f"{error}") window['-OUTPUT-'].update(f"{error}")
# Error for no Headers - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] == '' and values['-JSON-'] != '' and values['-COOKIES-'] != '': if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] == '' and values['-JSON-'] != '' and values['-COOKIES-'] != '':
window['-OUTPUT-'].update(f"No Headers provided") window['-OUTPUT-'].update(f"No Headers provided")
# Error for no Headers or JSON - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] == '' and values['-JSON-'] == '' and values['-COOKIES-'] != '':
window['-OUTPUT-'].update(f"No Headers or JSON provided")
# Error for no Headers or Cookies - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] == '' and values['-JSON-'] != '' and values['-COOKIES-'] == '':
window['-OUTPUT-'].update(f"No Headers or Cookies provided")
# Error for no JSON - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-JSON-'] == '' and values['-HEADERS-'] != '' and values['-COOKIES-'] != '': if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-JSON-'] == '' and values['-HEADERS-'] != '' and values['-COOKIES-'] != '':
window['-OUTPUT-'].update(f"No JSON provided") window['-OUTPUT-'].update(f"No JSON provided")
# Error for no JSON or Headers - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-JSON-'] == '' and values['-HEADERS-'] == '' and values['-COOKIES-'] != '':
window['-OUTPUT-'].update(f"No JSON or Headers provided")
# Error for no JSON or Cookies - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-JSON-'] == '' and values['-HEADERS-'] != '' and values['-COOKIES-'] == '':
window['-OUTPUT-'].update(f"No JSON or Cookies provided")
# Error for no Cookies - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-COOKIES-'] == '' and values['-HEADERS-'] != '' and values['-JSON-'] != '': if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-COOKIES-'] == '' and values['-HEADERS-'] != '' and values['-JSON-'] != '':
window['-OUTPUT-'].update(f"No Cookies provided") window['-OUTPUT-'].update(f"No Cookies provided")
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] == '' and values['-JSON-'] == '' and values['-COOKIES-'] == '': # Error for no Cookies or Headers - Crunchyroll
window['-OUTPUT-'].update(f"All fields empty!") if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-COOKIES-'] == '' and values['-HEADERS-'] == '' and values['-JSON-'] != '':
window['-OUTPUT-'].update(f"No Cookies or Headers provided")
# Error for no Cookies or JSON - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-COOKIES-'] == '' and values['-HEADERS-'] != '' and values['-JSON-'] == '':
window['-OUTPUT-'].update(f"No Cookies or JSON provided")
# Error if Headers, Cookies and JSON are empty - Crunchyroll
if values['-LIC_URL-'] != '' and values['-OPTIONS-'] == 'YouTube' and values['-HEADERS-'] == '' and values['-JSON-'] == '' and values['-COOKIES-'] == '':
window['-OUTPUT-'].update(f"No dictionaries provided")
# Error if no license URL - Crunchyroll
if values['-LIC_URL-'] == '' and values['-OPTIONS-'] == 'YouTube': if values['-LIC_URL-'] == '' and values['-OPTIONS-'] == 'YouTube':
window['-OUTPUT-'].update(f"No license URL provided") window['-OUTPUT-'].update(f"No license URL provided")
# Actions for reset button
if event == 'Reset': if event == 'Reset':
window['-PSSH-'].update(value="", disabled=False) window['-PSSH-'].update(value="", disabled=False)
window['-LIC_URL-'].update(value="", disabled=False) window['-LIC_URL-'].update(value="", disabled=False)
window['-OUTPUT-'].update(value="", disabled=False) window['-OUTPUT-'].update(value="", disabled=False)
window['-HEADERS-'].update(value="", disabled=False) window['-HEADERS-'].update(value="", disabled=False)
window['-OPTIONS-'].update(value="Generic", disabled=False) window['-OPTIONS-'].update(value="Generic", disabled=False)
window['-JSON-'].update(visible=False)
window['-JSON_TEXT-'].update(visible=False)
window['-COOKIES-'].update(visible=False)
window['-COOKIES_TEXT-'].update(visible=False)
# Actions for Crunchyroll selector
if event == '-OPTIONS-' and values['-OPTIONS-'] == 'Crunchyroll': if event == '-OPTIONS-' and values['-OPTIONS-'] == 'Crunchyroll':
window['-PSSH-'].update(value="", disabled=False) window['-PSSH-'].update(value="", disabled=False)
window['-LIC_URL-'].update(value="", disabled=True) window['-LIC_URL-'].update(value="", disabled=True)
window['-JSON-'].update(visible=False) window['-JSON-'].update(value="", visible=False)
window['-JSON_TEXT-'].update(visible=False) window['-JSON_TEXT-'].update(visible=False)
window['-COOKIES-'].update(visible=False) window['-COOKIES-'].update(value="", visible=False)
window['-COOKIES_TEXT-'].update(visible=False) window['-COOKIES_TEXT-'].update(visible=False)
# Actions for Generic selector
if event == '-OPTIONS-' and values['-OPTIONS-'] == 'Generic': if event == '-OPTIONS-' and values['-OPTIONS-'] == 'Generic':
window['-PSSH-'].update(value="", disabled=False) window['-PSSH-'].update(value="", disabled=False)
window['-LIC_URL-'].update(value="", disabled=False) window['-LIC_URL-'].update(value="", disabled=False)
window['-JSON-'].update(visible=False) window['-JSON-'].update(value="", visible=False)
window['-JSON_TEXT-'].update(visible=False) window['-JSON_TEXT-'].update(visible=False)
window['-COOKIES-'].update(visible=False) window['-COOKIES-'].update(value="", visible=False)
window['-COOKIES_TEXT-'].update(visible=False) window['-COOKIES_TEXT-'].update(visible=False)
# Actions for YouTube selector
if event == '-OPTIONS-' and values['-OPTIONS-'] == 'YouTube': if event == '-OPTIONS-' and values['-OPTIONS-'] == 'YouTube':
window['-PSSH-'].update(value="", disabled=True) window['-PSSH-'].update(value="", disabled=True)
window['-LIC_URL-'].update(value="", disabled=False) window['-LIC_URL-'].update(value="", disabled=False)

View File

@ -4,11 +4,12 @@ headers = {
'Accept-Language': 'en-US,en;q=0.5', 'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br', # 'Accept-Encoding': 'gzip, deflate, br',
'DNT': '1', 'DNT': '1',
'Connection': 'keep-alive',
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site', 'Sec-Fetch-Site': 'cross-site',
'Sec-GPC': '1', 'Sec-GPC': '1',
'Connection': 'keep-alive',
# Requests doesn't support trailers # Requests doesn't support trailers
# 'TE': 'trailers', # 'TE': 'trailers',
'Content-Type': 'application/x-www-form-urlencoded',
} }