oauth validation

This commit is contained in:
Piero 2023-02-19 17:03:49 -05:00
commit d136348371
3 changed files with 9 additions and 12 deletions

View file

@ -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)

2
archive/.log Normal file
View file

@ -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!!

View file

@ -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]