krypton-byte / tiktok-downloader

Tiktok Downloader/Scraper using requests & bs4
https://tiktok-dl.id
GNU General Public License v3.0
281 stars 82 forks source link

IndexError: list index out of range #15

Open xxkillaxx opened 2 years ago

xxkillaxx commented 2 years ago

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

gcipherd commented 2 years ago

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.

xxkillaxx commented 2 years ago

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.

3dian commented 2 years ago

same to me seems there is something wrong with snaptik API

Rizvanov-Rinat commented 2 years ago

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