TikTok-Api icon indicating copy to clipboard operation
TikTok-Api copied to clipboard

[QUESTION] - How to use proxies to get anothor region TikToks?

Open AbubakrChan opened this issue 9 months ago • 5 comments

Right now, I am able to fetch trending videos in my region only. I would like to be able to fetch anoyother region (like Japan) TikToks.

I was suggested to use proxies so I tried enabling VPN and it resulted into errors. If anyone can guide me on how I can successully set a proxy that would be great.

I also asked my colleagues from US to give me there mstoken so I can access TikTok from that region but that also didn't worked out.

I would be very thankfull for any kind of help.

Thanks

AbubakrChan avatar May 04 '24 09:05 AbubakrChan

When creating a session, have you tired passing a list of proxies? https://github.com/davidteather/TikTok-Api/blob/main/TikTokApi/tiktok.py#L203

Gereks123 avatar May 08 '24 14:05 Gereks123

@Gereks123 - Thank you for your reply! Yes I tried passing the list of proxies and it gave me "playwright timeout 30000ms exceeded" error. Please share if you have a working solution for this. Thanks.

AbubakrChan avatar May 08 '24 14:05 AbubakrChan

Or if you can share a sample code for the correct way to pass the proxy list, that would be great. Thanks

AbubakrChan avatar May 08 '24 14:05 AbubakrChan

here is how I am passing the proxy:

await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, context_options=context_options, proxies=['50.217.226.44:80'])

AbubakrChan avatar May 08 '24 14:05 AbubakrChan

@AbubakrChan Hello, How about the following code?

await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, context_options=context_options, proxies=[{"server": "http://50.217.226.44:80"}])

hitsuzi-meme avatar Jul 01 '24 10:07 hitsuzi-meme