Skip to content

Commit

Permalink
V2.9
Browse files Browse the repository at this point in the history
streamlink instead of youtube-dl
  • Loading branch information
Michele0303 committed Mar 27, 2023
1 parent 0773c88 commit a71dd9c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
18 changes: 0 additions & 18 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import argparse
import os
import subprocess

from enums import Mode, Info
from tiktokbot import TikTok
Expand All @@ -9,22 +7,6 @@
def banner() -> None:
print(Info.BANNER)

def check_requires():

with open(os.devnull) as devnull:
# check ffmpeg
try:
subprocess.call(["ffmpeg", "-version"], stdout=devnull, stderr=devnull)
except FileNotFoundError as ex:
raise FileNotFoundError("[-] Ffmpeg not installed. https://phoenixnap.com/kb/ffmpeg-windows")

# check youtube-dl
try:
subprocess.call(["youtube-dl", "--version"], stdout=devnull, stderr=devnull)
except FileNotFoundError as ex:
raise FileNotFoundError("[-] youtube-dl not installed. Run: pip install youtube-dl or https://github.com/ytdl-org/youtube-dl#installation\n")



def parse_args():
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests
argparse
youtube-dl
streamlink
3 changes: 2 additions & 1 deletion tiktokbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def start_recording(self):

print("\n[*] STARTED RECORDING... [PRESS ONLY ONCE CTRL + C TO STOP]")

cmd = f"youtube-dl --hls-prefer-ffmpeg --no-continue --no-part -o {output} {live_url}"
cmd = f"streamlink {live_url} best -o {output}"
#cmd = f"youtube-dl --hls-prefer-ffmpeg --no-continue --no-part -o {output} {live_url}"
with open("error.log", "w") as error_log, open("info.log", "w") as info:
p = subprocess.Popen(cmd, stderr=error_log, stdout=info, shell=True)
signal.signal(signal.SIGINT, lambda x, y: sys.exit(0))
Expand Down

0 comments on commit a71dd9c

Please sign in to comment.