dfreelon / pyktok

A simple module to collect video, text, and metadata from Tiktok.
BSD 3-Clause "New" or "Revised" License
316 stars 44 forks source link

save_tiktok_multi - IndexError: list index out of range #14

Closed klawicka closed 1 year ago

klawicka commented 1 year ago

I'm encountering the problem when I try to feed the save_tiktok_multi() and save_tiktok() functions tiktok links that look different then the example ones.

pyk.save_tiktok('https://www.tiktok.com/@tiktok/video/7106594312292453675?is_copy_url=1&is_from_webapp=v1',True,'video_data.csv') Works fine but

pyk.save_tiktok('https://www.tiktokv.com/share/video/7165671938071809286/',True,'video_data.csv') gives an IndexError: list index out of range. Showing that the issue is at regex_url = re.findall('(?<=@)(.+?)(?=\?|$)',video_ur

dfreelon commented 1 year ago

OK so the regex as written isn't gonna be able to handle that URL, but if you type it into a browser, you'll see that it resolves to https://www.tiktok.com/@bbiurluve/video/7165671938071809286?is_from_webapp=v1&item_id=7165671938071809286 for which save_tiktok does work as expected. I'll need to add functionality for URLs in the /share/video/ format in the next version.