mirror of
https://github.com/ovosimpatico/CLI-TikTok.git
synced 2026-01-15 11:52:52 -03:00
PEP8 Compliance
This commit is contained in:
108
main.py
108
main.py
@@ -1,110 +1,140 @@
|
|||||||
# Introduction and pre-test
|
# Introduction and pre-test
|
||||||
from src.init import init
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from src.init import init
|
||||||
|
|
||||||
a = init()
|
a = init()
|
||||||
if a == -1:
|
if a == -1:
|
||||||
print("Dependencies installed successfully.\nOpen the program again\n")
|
print("Dependencies installed successfully.\nOpen the program again\n")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# Import libraries and required functions after sucessful pre-test
|
# Import libraries and required functions after sucessful pre-test
|
||||||
from src.functions import listas
|
import os
|
||||||
from src.streaming import playbackrandom, playback
|
import subprocess
|
||||||
|
|
||||||
|
from src.byuser import getLinks, streamuser
|
||||||
from src.downloader import downloadtiktoks
|
from src.downloader import downloadtiktoks
|
||||||
from src.byuser import streamuser, getLinks
|
from src.functions import listas
|
||||||
import os, subprocess
|
from src.streaming import playback, playbackrandom
|
||||||
|
|
||||||
# Needlessly big code to simply prompt the user which action they want to do
|
# Needlessly big code to simply prompt the user which action they want to do
|
||||||
try:
|
try:
|
||||||
question = int(input("""Do you want to download or watch tiktoks?
|
question = int(
|
||||||
|
input(
|
||||||
|
"""Do you want to download or watch tiktoks?
|
||||||
|
|
||||||
(1) Download
|
(1) Download
|
||||||
(2) Watch
|
(2) Watch
|
||||||
"""))
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
os.system("cls || clear")
|
os.system("cls || clear")
|
||||||
|
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
if question == 1:
|
if question == 1:
|
||||||
downloadquestion = int(input("""Do you want to download your liked videos or a creator?
|
downloadquestion = int(
|
||||||
|
input(
|
||||||
|
"""Do you want to download your liked videos or a creator?
|
||||||
|
|
||||||
(1) Liked Videos
|
(1) Liked Videos
|
||||||
(2) Creator
|
(2) Creator
|
||||||
"""))
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
os.system("cls || clear")
|
os.system("cls || clear")
|
||||||
|
|
||||||
## Download liked videos
|
## Download liked videos
|
||||||
if downloadquestion == 1:
|
if downloadquestion == 1:
|
||||||
urls = listas()[0]
|
urls = listas()[0]
|
||||||
downloadtiktoks(urls)
|
downloadtiktoks(urls)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
## Download creator
|
## Download creator
|
||||||
if downloadquestion == 2:
|
if downloadquestion == 2:
|
||||||
print('Due to specific limitations of the current data method, downloading by creator will only get the latest 30 videos.')
|
print(
|
||||||
print('This limitation is being actively researched, any contributions will be welcome.')
|
"Due to specific limitations of the current data method, downloading by creator will only get the latest 30 videos."
|
||||||
username = str(input('Enter the tiktok username here: '))
|
)
|
||||||
|
print(
|
||||||
|
"This limitation is being actively researched, any contributions will be welcome."
|
||||||
|
)
|
||||||
|
username = str(input("Enter the tiktok username here: "))
|
||||||
links = getLinks(username)
|
links = getLinks(username)
|
||||||
downloadtiktoks(links)
|
downloadtiktoks(links)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
## Stream
|
## Stream
|
||||||
if question == 2:
|
if question == 2:
|
||||||
|
|
||||||
watchquestion = int(input("""Do you want to watch your liked videos or a creator?
|
watchquestion = int(
|
||||||
|
input(
|
||||||
|
"""Do you want to watch your liked videos or a creator?
|
||||||
|
|
||||||
(1) Liked Videos
|
(1) Liked Videos
|
||||||
(2) Creator
|
(2) Creator
|
||||||
"""))
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
os.system("cls || clear")
|
os.system("cls || clear")
|
||||||
|
|
||||||
## Stream liked videos
|
## Stream liked videos
|
||||||
if watchquestion == 1:
|
if watchquestion == 1:
|
||||||
|
|
||||||
|
randomquestion = int(
|
||||||
randomquestion = int(input("""Do you want to watch the tiktoks in randomized order?
|
input(
|
||||||
|
"""Do you want to watch the tiktoks in randomized order?
|
||||||
(1) Yes
|
(1) Yes
|
||||||
(2) No
|
(2) No
|
||||||
"""))
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
os.system("cls || clear")
|
os.system("cls || clear")
|
||||||
|
|
||||||
## Stream liked videos randomized
|
## Stream liked videos randomized
|
||||||
if randomquestion == 1:
|
if randomquestion == 1:
|
||||||
urls = listas()[0]
|
urls = listas()[0]
|
||||||
datas = listas()[1]
|
datas = listas()[1]
|
||||||
playbackrandom(urls, datas)
|
playbackrandom(urls, datas)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
## Stream liked videos in descending order
|
## Stream liked videos in descending order
|
||||||
if randomquestion == 2:
|
if randomquestion == 2:
|
||||||
urls = listas()[0]
|
urls = listas()[0]
|
||||||
datas = listas()[1]
|
datas = listas()[1]
|
||||||
playback(urls, datas)
|
playback(urls, datas)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
## Stream creator
|
## Stream creator
|
||||||
if watchquestion == 2:
|
if watchquestion == 2:
|
||||||
print('Due to specific limitations of the current data method, watching by creator will only get the latest 30 videos.')
|
print(
|
||||||
print('This limitation is being actively researched, any contributions will be welcome.')
|
"Due to specific limitations of the current data method, watching by creator will only get the latest 30 videos."
|
||||||
username = str(input('Enter the tiktok username here: '))
|
)
|
||||||
|
print(
|
||||||
|
"This limitation is being actively researched, any contributions will be welcome."
|
||||||
|
)
|
||||||
|
username = str(input("Enter the tiktok username here: "))
|
||||||
streamuser(username)
|
streamuser(username)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# Error handling for invalid number (3, 4, 6, 133)
|
# Error handling for invalid number (3, 4, 6, 133)
|
||||||
print("The option you chose isn't valid.")
|
print("The option you chose isn't valid.")
|
||||||
|
|
||||||
# Error handling for invalid input (ENTER, 't', '5ga')
|
# Error handling for invalid input (ENTER, 't', '5ga')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("The option you chose isn't valid.")
|
print("The option you chose isn't valid.")
|
||||||
|
|
||||||
# Error handling for missing Likes.txt file
|
# Error handling for missing Likes.txt file
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("The 'Likes.txt' file was not found. Make sure it is in the program folder and try again.")
|
print(
|
||||||
|
"The 'Likes.txt' file was not found. Make sure it is in the program folder and try again."
|
||||||
|
)
|
||||||
|
|
||||||
# Error handling for MPV media player or MPV not found in PATH
|
# Error handling for MPV media player or MPV not found in PATH
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
os.system("cls || clear")
|
os.system("cls || clear")
|
||||||
print("Mpv media player was not found on your system path. Make sure it's installed and try again.")
|
print(
|
||||||
|
"Mpv media player was not found on your system path. Make sure it's installed and try again."
|
||||||
|
)
|
||||||
|
|
||||||
# Error handling for exiting the code with CTRL + C
|
# Error handling for exiting the code with CTRL + C
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\n\tKeyboardInterrupt was detected - Goodbye!")
|
print("\n\tKeyboardInterrupt was detected - Goodbye!")
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -1,2 +1,3 @@
|
|||||||
import os
|
import os
|
||||||
os.system("pip install -r requirements.txt --user")
|
|
||||||
|
os.system("pip install -r requirements.txt --user")
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import requests
|
|
||||||
import atoma
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import atoma
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
def info(username):
|
def info(username):
|
||||||
|
|
||||||
response = requests.get(f'https://proxitok.pussthecat.org/@{username}/rss')
|
response = requests.get(f"https://proxitok.pussthecat.org/@{username}/rss")
|
||||||
if response.status_code == 404:
|
if response.status_code == 404:
|
||||||
print("Something went wrong while getting the information. Make sure the username was correctly inserted and try again.")
|
print(
|
||||||
|
"Something went wrong while getting the information. Make sure the username was correctly inserted and try again."
|
||||||
|
)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if str(response.content) == "b''":
|
if str(response.content) == "b''":
|
||||||
print("The specified account does not exist.")
|
print("The specified account does not exist.")
|
||||||
@@ -16,14 +20,15 @@ def info(username):
|
|||||||
# if feed.description == None:
|
# if feed.description == None:
|
||||||
# print("This account does not have a bio.")
|
# print("This account does not have a bio.")
|
||||||
# else:
|
# else:
|
||||||
#print(feed.description) ## TIKTOK BIO
|
# print(feed.description) ## TIKTOK BIO
|
||||||
|
|
||||||
|
|
||||||
def getLinks(username):
|
def getLinks(username):
|
||||||
feed = info(username)
|
feed = info(username)
|
||||||
linklist = []
|
linklist = []
|
||||||
|
|
||||||
for i in range(len(feed.items)):
|
for i in range(len(feed.items)):
|
||||||
linklist.append('https://www.tiktok.com' + feed.items[i].link)
|
linklist.append("https://www.tiktok.com" + feed.items[i].link)
|
||||||
return linklist
|
return linklist
|
||||||
|
|
||||||
|
|
||||||
@@ -35,4 +40,5 @@ def streamuser(username):
|
|||||||
|
|
||||||
for i in range(len(links)):
|
for i in range(len(links)):
|
||||||
from src.streaming import mpv
|
from src.streaming import mpv
|
||||||
mpv(links[i])
|
|
||||||
|
mpv(links[i])
|
||||||
|
|||||||
@@ -1,43 +1,48 @@
|
|||||||
from src.functions import detect_dead_link
|
import os
|
||||||
from src.functions import url_redirection
|
|
||||||
|
|
||||||
|
from src.functions import detect_dead_link, url_redirection
|
||||||
from yt_dlp import YoutubeDL
|
from yt_dlp import YoutubeDL
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
def downloader(url):
|
def downloader(url):
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'ignoreerrors': True,
|
"ignoreerrors": True,
|
||||||
'format': 'bestvideo*+bestaudio/best',
|
"format": "bestvideo*+bestaudio/best",
|
||||||
'outtmpl': os.getcwd()+'/video/by-creator/%(creator)s/%(id)s.%(ext)s'
|
"outtmpl": os.getcwd()
|
||||||
|
+ "/video/by-creator/%(creator)s/%(id)s.%(ext)s",
|
||||||
}
|
}
|
||||||
YoutubeDL(ydl_opts).download(url)
|
YoutubeDL(ydl_opts).download(url)
|
||||||
|
|
||||||
|
|
||||||
def downloadtiktoks(urls):
|
def downloadtiktoks(urls):
|
||||||
index = -1
|
index = -1
|
||||||
errorcount = []
|
errorcount = []
|
||||||
a = input(f"""
|
a = input(
|
||||||
|
f"""
|
||||||
**WARNING**
|
**WARNING**
|
||||||
This action will download up to {len(urls)} tiktoks in CLI-TIkTok/video/
|
This action will download up to {len(urls)} tiktoks in CLI-TIkTok/video/
|
||||||
Ensure you have enough free space before proceeding!
|
Ensure you have enough free space before proceeding!
|
||||||
\n\t\tPress ENTER to proceed...
|
\n\t\tPress ENTER to proceed...
|
||||||
""")
|
"""
|
||||||
if a != '':
|
)
|
||||||
print('Operation canceled.')
|
if a != "":
|
||||||
|
print("Operation canceled.")
|
||||||
return
|
return
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
randomvideo = index = index + 1
|
randomvideo = index = index + 1
|
||||||
url = url_redirection(urls[randomvideo])
|
url = url_redirection(urls[randomvideo])
|
||||||
|
|
||||||
if detect_dead_link(url) == True:
|
if detect_dead_link(url) == True:
|
||||||
downloader(url)
|
downloader(url)
|
||||||
print('')
|
print("")
|
||||||
else:
|
else:
|
||||||
errorcount.append(urls)
|
errorcount.append(urls)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("The tiktoks were downloaded")
|
print("The tiktoks were downloaded")
|
||||||
return
|
return
|
||||||
if len(errorcount) != 0:
|
if len(errorcount) != 0:
|
||||||
print(f'\n{len(errorcount)} video(s) failed to download.\nThe video(s) were likely banned or removed from the platform.')
|
print(
|
||||||
|
f"\n{len(errorcount)} video(s) failed to download.\nThe video(s) were likely banned or removed from the platform."
|
||||||
|
)
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import requests
|
|
||||||
import random
|
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
def listas():
|
def listas():
|
||||||
#Retrieves tiktok links and dates from Likes.txt
|
# Retrieves tiktok links and dates from Likes.txt
|
||||||
i = 0
|
i = 0
|
||||||
arquivo = open('Likes.txt', 'r', encoding='utf-8')
|
arquivo = open("Likes.txt", "r", encoding="utf-8")
|
||||||
linhas = arquivo.readlines()
|
linhas = arquivo.readlines()
|
||||||
tamanho = len(linhas)
|
tamanho = len(linhas)
|
||||||
arquivo.close()
|
arquivo.close()
|
||||||
@@ -14,7 +15,7 @@ def listas():
|
|||||||
vet = []
|
vet = []
|
||||||
listalinks = []
|
listalinks = []
|
||||||
listadatas = []
|
listadatas = []
|
||||||
arquivo = open('Likes.txt', 'r', encoding='utf-8')
|
arquivo = open("Likes.txt", "r", encoding="utf-8")
|
||||||
|
|
||||||
while i <= tamanho:
|
while i <= tamanho:
|
||||||
lelinha = arquivo.readline().rstrip()
|
lelinha = arquivo.readline().rstrip()
|
||||||
@@ -23,38 +24,40 @@ def listas():
|
|||||||
arquivo.close()
|
arquivo.close()
|
||||||
|
|
||||||
for i in range(2, len(vet), 3):
|
for i in range(2, len(vet), 3):
|
||||||
listalinks.append(vet[i-1][1])
|
listalinks.append(vet[i - 1][1])
|
||||||
|
|
||||||
for i in range(2, len(vet), 3):
|
for i in range(2, len(vet), 3):
|
||||||
listadatas.append(vet[i-2][1] + ' ' + vet[i-2][2])
|
listadatas.append(vet[i - 2][1] + " " + vet[i - 2][2])
|
||||||
|
|
||||||
return listalinks, listadatas
|
return listalinks, listadatas
|
||||||
|
|
||||||
|
|
||||||
#Unused function - Might be useful in future iterations of the project
|
# Unused function - Might be useful in future iterations of the project
|
||||||
#https://github.com/nanometer5088/CLI-TikTok/commit/ad589d7b324042ee85a270625df3ad9f6f82ab8a
|
# https://github.com/nanometer5088/CLI-TikTok/commit/ad589d7b324042ee85a270625df3ad9f6f82ab8a
|
||||||
def removevideo():
|
def removevideo():
|
||||||
if os.path.exists(os.getcwd()+"/video/video"):
|
if os.path.exists(os.getcwd() + "/video/video"):
|
||||||
os.remove(os.getcwd()+"/video/video")
|
os.remove(os.getcwd() + "/video/video")
|
||||||
|
|
||||||
|
|
||||||
def detect_dead_link(url):
|
def detect_dead_link(url):
|
||||||
#Detects if the video is available to be streamed or downloaded.
|
# Detects if the video is available to be streamed or downloaded.
|
||||||
dead_url_start_with = 'https://www.tiktok.com/@/video'
|
dead_url_start_with = "https://www.tiktok.com/@/video"
|
||||||
#No user on the @ means video was removed, taken down or isn't in a video format
|
# No user on the @ means video was removed, taken down or isn't in a video format
|
||||||
if dead_url_start_with in url:
|
if dead_url_start_with in url:
|
||||||
return False # Means do not proceed with the download
|
return False # Means do not proceed with the download
|
||||||
else:
|
else:
|
||||||
return True # Means it's all clear to download.
|
return True # Means it's all clear to download.
|
||||||
|
|
||||||
|
|
||||||
def url_redirection(url):
|
def url_redirection(url):
|
||||||
#Tiktok links from the Likes.txt are shortened. They need to be redirected to the final link, which is done here.
|
# Tiktok links from the Likes.txt are shortened. They need to be redirected to the final link, which is done here.
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36'}
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
|
||||||
|
}
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
return response.url
|
return response.url
|
||||||
|
|
||||||
|
|
||||||
def randomvideo(urls):
|
def randomvideo(urls):
|
||||||
#Chooses a random video from Likes.txt - Optional Feature
|
# Chooses a random video from Likes.txt - Optional Feature
|
||||||
return random.randint(0, (len(urls) - 1))
|
return random.randint(0, (len(urls) - 1))
|
||||||
|
|||||||
44
src/init.py
44
src/init.py
@@ -1,25 +1,32 @@
|
|||||||
from os import system
|
|
||||||
import sys
|
import sys
|
||||||
|
from os import system
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
#Intro for the user
|
# Intro for the user
|
||||||
system("cls || clear")
|
system("cls || clear")
|
||||||
input("Welcome to CLI TikTok, an open-source TikTok archiver and viewer!\nPress ENTER to proceed")
|
input(
|
||||||
|
"Welcome to CLI TikTok, an open-source TikTok archiver and viewer!\nPress ENTER to proceed"
|
||||||
|
)
|
||||||
|
|
||||||
# Detect and install libraries - If they aren't installed,
|
# Detect and install libraries - If they aren't installed,
|
||||||
# the user is prompted to make the auto-installation.
|
# the user is prompted to make the auto-installation.
|
||||||
try:
|
try:
|
||||||
import yt_dlp
|
|
||||||
import requests
|
|
||||||
import atoma
|
import atoma
|
||||||
|
import requests
|
||||||
|
import yt_dlp
|
||||||
|
|
||||||
system("cls || clear")
|
system("cls || clear")
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
system("cls || clear")
|
system("cls || clear")
|
||||||
input("""
|
input(
|
||||||
|
"""
|
||||||
The program detected dependencies are not installed
|
The program detected dependencies are not installed
|
||||||
Press ENTER to install the necessary libraries
|
Press ENTER to install the necessary libraries
|
||||||
|
|
||||||
(You will need to open the program again afterwards)
|
(You will need to open the program again afterwards)
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
system("pip install -r requirements.txt --user")
|
system("pip install -r requirements.txt --user")
|
||||||
system("cls || clear")
|
system("cls || clear")
|
||||||
return -1
|
return -1
|
||||||
@@ -28,11 +35,15 @@ def init():
|
|||||||
# If the user does not have internet access, warns him the software won't work properly and quit.
|
# If the user does not have internet access, warns him the software won't work properly and quit.
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
data = requests.get("https://raw.githubusercontent.com/nanometer5088/CLI-TikTok/main/VERSION")
|
|
||||||
version = open('VERSION', 'r', encoding='utf=8')
|
data = requests.get(
|
||||||
|
"https://raw.githubusercontent.com/nanometer5088/CLI-TikTok/main/VERSION"
|
||||||
|
)
|
||||||
|
version = open("VERSION", "r", encoding="utf=8")
|
||||||
if version.readline().rstrip() > (data.text):
|
if version.readline().rstrip() > (data.text):
|
||||||
system("cls || clear")
|
system("cls || clear")
|
||||||
input("""
|
input(
|
||||||
|
"""
|
||||||
There's a new version available!
|
There's a new version available!
|
||||||
Updates bring performance and feature improvements!
|
Updates bring performance and feature improvements!
|
||||||
|
|
||||||
@@ -40,10 +51,15 @@ def init():
|
|||||||
https://github.com/nanometer5088/CLI-TikTok/archive/refs/heads/main.zip
|
https://github.com/nanometer5088/CLI-TikTok/archive/refs/heads/main.zip
|
||||||
|
|
||||||
Press ENTER to proceed
|
Press ENTER to proceed
|
||||||
""")
|
"""
|
||||||
|
)
|
||||||
version.close()
|
version.close()
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
print("CLI-TikTok detected your device isn't connected to the internet")
|
print(
|
||||||
print("This software requires a reliable and uncensored internet connection to properly work")
|
"CLI-TikTok detected your device isn't connected to the internet"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
"This software requires a reliable and uncensored internet connection to properly work"
|
||||||
|
)
|
||||||
print("Please try again with an internet connection")
|
print("Please try again with an internet connection")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|||||||
@@ -1,34 +1,32 @@
|
|||||||
from src.functions import detect_dead_link
|
import os
|
||||||
from src.functions import url_redirection
|
import subprocess
|
||||||
|
|
||||||
|
from src.functions import detect_dead_link, url_redirection
|
||||||
from yt_dlp import YoutubeDL
|
from yt_dlp import YoutubeDL
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
|
|
||||||
def getVideoInfo(url):
|
def getVideoInfo(url):
|
||||||
ydl_opts = {
|
ydl_opts = {"quiet": True, "simulate": True, "forceurl": True}
|
||||||
"quiet": True,
|
|
||||||
"simulate": True,
|
|
||||||
"forceurl": True
|
|
||||||
}
|
|
||||||
|
|
||||||
return YoutubeDL(ydl_opts).extract_info(url)["url"]
|
return YoutubeDL(ydl_opts).extract_info(url)["url"]
|
||||||
|
|
||||||
|
|
||||||
def mpv(url):
|
def mpv(url):
|
||||||
subprocess.check_output(f'mpv "{getVideoInfo(url)}"', shell=True)
|
subprocess.check_output(f'mpv "{getVideoInfo(url)}"', shell=True)
|
||||||
|
|
||||||
|
|
||||||
def playbackrandom(urls, datas):
|
def playbackrandom(urls, datas):
|
||||||
while True:
|
while True:
|
||||||
os.system("cls || clear")
|
os.system("cls || clear")
|
||||||
from src.functions import randomvideo
|
from src.functions import randomvideo
|
||||||
|
|
||||||
randomvideo = randomvideo(urls)
|
randomvideo = randomvideo(urls)
|
||||||
url = url_redirection(urls[randomvideo])
|
url = url_redirection(urls[randomvideo])
|
||||||
|
|
||||||
if detect_dead_link(url) == True:
|
if detect_dead_link(url) == True:
|
||||||
print(f'\nVideo Liked - {datas[randomvideo]}\n')
|
print(f"\nVideo Liked - {datas[randomvideo]}\n")
|
||||||
mpv(url)
|
mpv(url)
|
||||||
|
|
||||||
|
|
||||||
def playback(urls, datas):
|
def playback(urls, datas):
|
||||||
index = 0
|
index = 0
|
||||||
@@ -37,9 +35,9 @@ def playback(urls, datas):
|
|||||||
try:
|
try:
|
||||||
randomvideo = index = index + 1
|
randomvideo = index = index + 1
|
||||||
url = url_redirection(urls[randomvideo])
|
url = url_redirection(urls[randomvideo])
|
||||||
|
|
||||||
if detect_dead_link(url) == True:
|
if detect_dead_link(url) == True:
|
||||||
print(f'\nVideo Liked - {datas[randomvideo]}\n')
|
print(f"\nVideo Liked - {datas[randomvideo]}\n")
|
||||||
mpv(url)
|
mpv(url)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("All tiktoks were played.")
|
print("All tiktoks were played.")
|
||||||
|
|||||||
Reference in New Issue
Block a user