Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INSTALLATION] - Change the region of content #1135

Open
SP-l33t opened this issue Mar 30, 2024 · 8 comments
Open

[INSTALLATION] - Change the region of content #1135

SP-l33t opened this issue Mar 30, 2024 · 8 comments
Labels
installation_help Someone is having problems installing the api

Comments

@SP-l33t
Copy link

SP-l33t commented Mar 30, 2024

Hello there!

Is there any way to change the region in which TikTokApi searches for videos without using proxies?
I know there is such option in modified mobile clients.

Thanks in advance!

@SP-l33t SP-l33t added the installation_help Someone is having problems installing the api label Mar 30, 2024
@AbubakrChan
Copy link

Hey! - Please let me know if you know a way to do that so.

Thanks

@SP-l33t
Copy link
Author

SP-l33t commented Apr 29, 2024

Only using a proxy through Proxifier (for chromium) worked for me, nothing else.

@AbubakrChan
Copy link

Thank you soo much for your swift response!

Can you please confirm if that is how you set up the proxifier:

from TikTokApi import TikTokApi
import asyncio
import os
import proxifier

ms_token = "x"

context_options = {
    'viewport': {'width': 1280, 'height': 1024},
    'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36'
}

# Set up proxifier
proxifier.setup(
    endpoint="your_proxy_endpoint",  # Replace with your proxy endpoint
    username="your_proxy_username",  # Replace with your proxy username (if required)
    password="your_proxy_password"   # Replace with your proxy password (if required)
)

async def trending_videos():
    async with TikTokApi() as api:
        await api.create_sessions(ms_tokens=[ms_token], num_sessions=1, sleep_after=3, context_options=context_options)

        videos_data = []
        async for video in api.trending.videos(count=30):
            print(video)

        return videos_data

if __name__ == "__main__":
    asyncio.run(trending_videos())

@SP-l33t
Copy link
Author

SP-l33t commented Apr 29, 2024

Actually no.
I just run this app in the background https://www.proxifier.com/
And I set up the rules so it proxies connections from Chromium through the proxy.

@AbubakrChan
Copy link

@SP-l33t
Do the proxifier really helped in getting another region tiktoks?

Thanks

@SP-l33t
Copy link
Author

SP-l33t commented May 2, 2024

Yeah. With It I can get the content of the proxy region.

@AbubakrChan
Copy link

Yeah. With It I can get the content of the proxy region.

That's great!
I've been working on it for the past few days but haven't been able to achieve success. I tried to use Proxifier but was unsuccessful. I would really appreciate it if you could share the code that worked for you or any links to helpful resources or detailed instructions on how to accomplish this task whenever it's convenient for you.
It could be beneficial for anyone encountering this issue in the future

Thank you!

@AbubakrChan
Copy link

@SP-l33t
Could you please look into it?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation_help Someone is having problems installing the api
Projects
None yet
Development

No branches or pull requests

2 participants