tiktok-downloader
tiktok-downloader copied to clipboard
IndexError: list index out of range
Video loading does not work. I get an error: tiktok_downloader.snaptik(url).get_media()[0].download()
Traceback (most recent call last):
File "C:\Users\Николай\Desktop\BOT_tg\test.py", line 17, in
HELP!!!
Video loading does not work. I get an error: tiktok_downloader.snaptik(url).get_media()[0].download()
Traceback (most recent call last): File "C:\Users\Николай\Desktop\BOT_tg\test.py", line 17, in tiktok_downloader.snaptik(url).get_media()[0] IndexError: list index out of range
HELP!!!
I don't know if you solved this yet, but you can use Tikmate instead; it works for me.
tiktok_downloader.tikmate().get_media(url)[0]
notice the url now it's a parameter of get_media.
Video loading does not work. I get an error: tiktok_downloader.snaptik(url).get_media()[0].download() Traceback (most recent call last): File "C:\Users\Николай\Desktop\BOT_tg\test.py", line 17, in tiktok_downloader.snaptik(url).get_media()[0] IndexError: list index out of range HELP!!!
I don't know if you solved this yet, but you can use Tikmate instead; it works for me.
tiktok_downloader.tikmate().get_media(url)[0]
notice the url now it's a parameter of get_media.
Thanks for the help.
same to me seems there is something wrong with snaptik API
As practice shows, some services stop working from time to time. And this library provides a convenient enumeration of all services. You can use it something like this:
from tiktok_downloader import services, InvalidUrl
def downloader(url):
name = 'Video_name.mp4'
for service in services.values():
try:
media = service(url)
except InvalidUrl as e: # InvaldUrl exception sometimes occurs even with correct URLs.
print(e)
if media:
media[0].download(name)
break
else:
print(f'InvalidUrl: {url}')