tiktok-downloader icon indicating copy to clipboard operation
tiktok-downloader copied to clipboard

IndexError: list index out of range

Open xxkillaxx opened this issue 2 years ago • 4 comments

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

xxkillaxx avatar Mar 18 '22 19:03 xxkillaxx

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.

gcipherd avatar Mar 23 '22 01:03 gcipherd

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.

xxkillaxx avatar Mar 24 '22 18:03 xxkillaxx

same to me seems there is something wrong with snaptik API

3dian avatar Mar 27 '22 03:03 3dian

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}')

Rizvanov-Rinat avatar Apr 17 '22 13:04 Rizvanov-Rinat