From d13634837138b7fbf9c7d64ce186cadaa6ec6f9c Mon Sep 17 00:00:00 2001 From: Piero <55633887+piero0920@users.noreply.github.com> Date: Sun, 19 Feb 2023 17:03:49 -0500 Subject: [PATCH] oauth validation --- .env.sample | 8 -------- archive/.log | 2 ++ twitch-archive.py | 11 +++++++---- 3 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 .env.sample create mode 100644 archive/.log diff --git a/.env.sample b/.env.sample deleted file mode 100644 index 1d84909..0000000 --- a/.env.sample +++ /dev/null @@ -1,8 +0,0 @@ -#twitch config -CLIENT-ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # If you don't have client id then register new app: https://dev.twitch.tv/console/apps -CLIENT-SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Manage application -> new secret -OAUTH-PRIVATE-TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # if you dont want ads or to download sub-only vods, there's a tutorial here: https://youtu.be/1MBsUoFGuls -#gmail config -SENDER=example@gmail.com #your gmail, from where the messages are going to be sended -PWD=xxxxxxxxxxxxxxxx #password for your gmail, regular password doenst work here, here's how to get to generate a password to use: https://stackoverflow.com/a/73214197 -RECEIVER=example@gmail.com #gmail to who you want to send notifications (your own gmail works) \ No newline at end of file diff --git a/archive/.log b/archive/.log new file mode 100644 index 0000000..743e92a --- /dev/null +++ b/archive/.log @@ -0,0 +1,2 @@ +2023-02-19T18:48:48Z - dogzilar123 - Pibito goma ,Manitas cap 7 y Seguimos con los demas Pendientes Noien, baki etc y Talvez Tier de ending!! +2023-02-19T18:48:48Z - dogzilar123 - Pibito goma ,Manitas cap 7 y Seguimos con los demas Pendientes Noien, baki etc y Talvez Tier de ending!! diff --git a/twitch-archive.py b/twitch-archive.py index b82ec9f..4be768b 100644 --- a/twitch-archive.py +++ b/twitch-archive.py @@ -8,8 +8,8 @@ from email.mime.text import MIMEText class TwitchArchive: def __init__(self): # user configuration - self.username = "KalathrasLolweapon" # Twitch streamer username - self.quality = "audio_only" # Qualities options: best/source high/720p medium/540p low/360p audio_only + self.username = "dogzilar123" # Twitch streamer username + self.quality = "best" # Qualities options: best/source high/720p medium/540p low/360p audio_only # global configuration self.root_path = r"archive" # Path where this script saves everything (livestream,VODs,chat,metadata) self.rclone_path = "remote:path" # Path to rclone remote storage @@ -166,9 +166,12 @@ class TwitchArchive: if self.quality == 'audio_only': live_proc_path = os.path.join(self.video_path, "LIVE_" + live_raw_filename + ".mp3") - + + if (os.getenv("OAUTH-PRIVATE-TOKEN") != "" or os.getenv("OAUTH-PRIVATE-TOKEN") is not None or os.getenv("OAUTH-PRIVATE-TOKEN") != "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"): + auth = ['--twitch-api-header', 'Authorization=OAuth ' + os.getenv('OAUTH-PRIVATE-TOKEN')] + else: auth = ''.split() self.sendNotif('Stream - ' + live_raw_filename, 'Streamer went live: ' + is_live["title"]) - subprocess.call(['streamlink', 'twitch.tv/'+ self.username, self.quality, '--twitch-api-header', 'Authorization=OAuth ' + os.getenv('OAUTH-PRIVATE-TOKEN'), '--hls-segment-threads', str(self.hls_segments), '--hls-live-restart', '--retry-streams', str(self.refresh), '--twitch-disable-reruns', '-o', live_raw_path] + ttvlol) + subprocess.call(['streamlink', 'twitch.tv/'+ self.username, self.quality, '--hls-segment-threads', str(self.hls_segments), '--hls-live-restart', '--retry-streams', str(self.refresh), '--twitch-disable-reruns', '-o', live_raw_path] + ttvlol + auth) if(os.path.exists(live_raw_path) is True and self.onlyRaw == 0): ffmpeg_settings = ['-y', '-i', live_raw_path, '-analyzeduration', '2147483647', '-probesize', '2147483647', '-c:v', 'copy', '-c:a', 'copy', '-start_at_zero', '-copyts', live_proc_path] if self.quality == 'audio_only': ffmpeg_settings = ['-i', live_raw_path, '-vn', '-ar', '44100', '-ac', '2', '-b:a', '192k', live_proc_path]