dfreelon / pyktok

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

get_account_video_urls not working #2

Closed nothingcomeseasy closed 2 years ago

nothingcomeseasy commented 2 years ago

First of all, thanks for this tool @dfreelon , it will help me a lot and I'm sure it will help many people!

Whenever I try to use the code below:

tiktok_videos = pyk.get_account_video_urls('https://www.tiktok.com/@tiktok')

I get the following error:

AttributeError: 'NoneType' object has no attribute 'string'

Am I doing something wrong?

dfreelon commented 2 years ago

Hi, try it again now. I just tried it twice, and the first time it triggered the same error you got, but the second time it worked (exact same code both times). Maybe it's a network issue? Good luck!

dfreelon commented 2 years ago

Hi, any update on this? LMK if you have time so I can close this if it works

nothingcomeseasy commented 2 years ago

Hey, yes. In my laptop running ubuntu linux it works fine. I was trying in my windows computer and for some reason it doesnt work there. you can close it yes :) thanks!

dfreelon commented 2 years ago

Great, thanks.

liabozarth commented 2 years ago

Hi, I have the same issue on my ubuntu.

code

import browser_cookie3 cj = browser_cookie3.chrome(domain_name='tiktok.com') print('cookie jar for tiktok', cj)

import pyktok as pyk tiktok_videos = pyk.get_account_video_urls('https://www.tiktok.com/@tiktok') print(tiktok_videos)

error output

Traceback (most recent call last): File "/home/lboz/PycharmProjects/newPrj/tests/test_pyktok.py", line 6, in tiktok_videos = pyk.get_account_video_urls('https://www.tiktok.com/@tiktok') File "/home/lboz/.local/lib/python3.10/site-packages/pyktok/pyktok.py", line 31, in get_account_video_urls tt_json = get_tiktok_json(user_url) File "/home/lboz/.local/lib/python3.10/site-packages/pyktok/pyktok.py", line 47, in get_tiktok_json tt_json = json.loads(tt_script.string) AttributeError: 'NoneType' object has no attribute 'string'

dfreelon commented 2 years ago

This appears to be an intermittent issue, you might try again later or on another machine/OS. One thing you can do to troubleshoot is run get_tiktok_json on your video URL and inspect the results. If it's a large JSON object with lots of metadata in it you should be fine, but if it's small with no metadata, it's a server-side issue the software can't fix.

I'll push out a version with a proper error message for this soon.