Closed 0xSFAYGA closed 1 year ago
I have the same error
in this location try to change hearders .
File "/home/me/Tk/env/lib/python3.11/site-packages/TikTokApi/api/trending.py
spawn = requests.head(
"https://www.tiktok.com",
proxies=Trending.parent._format_proxy(processed.proxy),
**Trending.parent._requests_extra_kwargs,
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"}
)
Can confirm, I have also this issue from this:
from TikTokApi import TikTokApi
verify_fp='...'
api = TikTokApi(custom_verify_fp=verify_fp)
for video in api.trending.videos(count=5):
print(video.id)
The suggestion from @souffyan does not seem to help - the error dissapears, but the code is freezing and does not return anything.
Can confirm, I have also this issue from this:
from TikTokApi import TikTokApi verify_fp='...' api = TikTokApi(custom_verify_fp=verify_fp) for video in api.trending.videos(count=5): print(video.id)
The suggestion from @souffyan does not seem to help - the error dissapears, but the code is freezing and does not return anything.
me to .
from TikTokApi import TikTokApi
with TikTokApi() as api:
user = api.user(username="therock")
for video in user.videos():
print(video.id)
I've tested the one from the example, and also getting the same error
Any updates about this issue?
any fix??
Any updates?
same issue here!
and updates
Same problem here.
This is the code (including the cookie):
from TikTokApi import TikTokApi
import json
# read data from json file, cookie exported from webbrowser
def get_cookies_from_file():
with open('www.tiktok.com.cookies.json') as f:
cookies = json.load(f)
cookies_kv = {} # key-value
for cookie in cookies:
cookies_kv[ cookie['name'] ] = cookie['value']
print ( cookie['name'] + "=" + cookie['value'] )
return cookies_kv
print('Reading data from cookie file...')
cookies = get_cookies_from_file() #obtiene un dictionary key-value
def get_cookies(**kwargs):
return cookies
api = TikTokApi()
api._get_cookies = get_cookies
print(" Requesting data from TikTok")
for video in api.trending.videos():
print ( video.author.username)
The output:
Requesting data from TikTok
Traceback (most recent call last):
File "D:\desarrollo\tiktok\tiktokapi.py", line 39, in
Same issue on Python 3.8 and 3.11
Having the same issue on all my systems: Windows 11 with Python 3.11, Windows 10 with Python 3.10 and MacOS Venture 13.0.1 with Python 3.11.1
Same issue on macOS Big Sur, Python 3.8, TikTokApi==5.2.2
spawn = requests.head(
"https://www.tiktok.com",
proxies=Trending.parent._format_proxy(processed.proxy),
**Trending.parent._requests_extra_kwargs,
)
with open("cookies.txt", "w") as file:
file.write(str(spawn.cookies.keys()))
cookies.txt
['_abck', 'bm_sz']
Does anyone know if this issue is present in older versions? If not, maybe it makes sense downgrading for the moment.
also the same problem. is anyone managed to fix it? please let me know.
I had the same problem but basically I was trying to download videos and get some of the video data so I found a better library that would do this for me:
https://github.com/Evil0ctal/Douyin_TikTok_Download_API
If you look into the scraper.py file you will see the functions that you need to do this and basically all you gotta do is get the video id from the url using the built in function and then you get video data using the video id using the other built in function. Look at their readme.md page to see how they used asyncio and all that. When you get the video data it's just a massive dictionary that you can look through and get exactly what you want from it. It will have links to where you can download the video information.
Hope this helps.
On Fri, May 26, 2023 at 5:02 PM Geng Liu @.***> wrote:
also the same problem. is anyone managed to fix it? please let me know.
— Reply to this email directly, view it on GitHub https://github.com/davidteather/TikTok-Api/issues/979#issuecomment-1564948570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYTU533KAK45UKYQNKPRTSTXIEK7HANCNFSM6AAAAAASQKSTHU . You are receiving this because you commented.Message ID: @.***>
Should be fixed in V6 I think it shouldn't load cookies directly anymore
Hi i try am may ways to slove the problem .
`File "/home/me/Tk/main.py", line 29, in
for trending_video in api.trending.videos(count=5):
File "/home/me/Tk/env/lib/python3.11/site-packages/TikTokApi/api/trending.py", line 40, in videos
ttwid = spawn.cookies["ttwid"]