How To Use Proxies With MediaCrawler: Single and Multi-Proxy Setup

To use a proxy with MediaCrawler, open config/base_config.py, set ENABLE_IP_PROXY to True, set IP_PROXY_PROVIDER_NAME to static, and add your proxy URL to STATIC_PROXY_URL. Also set ENABLE_CDP_MODE to False, because the browser skips the proxy in CDP mode. MediaCrawler supports HTTP proxies only, not SOCKS5. Use a static residential proxy or a sticky session, so the IP stays the same from login to the last request. For a list of proxies, add a custom provider, and each run picks one at random.
MediaCrawler is built solely for research purposes and helps you crawl public information from platforms like Xiaohongshu, Douyin, and more. But repeated crawl requests from a shared home or office network can get the IP flagged and affect other users sharing the same IP. This is where using proxies with MediaCrawler helps.
In this guide, we will cover different ways to configure proxies with MediaCrawler, discuss which proxy type fits your setup, and troubleshoot some common problems.
What are MediaCrawler’s proxy configuration options?
MediaCrawler ships with a built-in proxy pool that supports three providers: kuaidaili, wandouhttp, and static.
- kuaidaili and wandouhttp are pre-configured integrations for these specific Chinese proxy vendors.
- The static option allows you to use proxies from any global proxy provider, like Byteful.
Additionally, if you need to use multiple proxies with MediaCrawler, you can also configure a custom proxy provider. The next sections cover the setup details for both the static option and custom providers.
Method 1: MediaCrawler’s Static Provider With One Proxy URL
To configure proxies with MediaCrawler using the static option, you first need proxy details, which include the proxy host, port, username, and password. You can get these details from your provider’s dashboard.
To get your proxy details from our dashboard, log in and open the section for the proxy type you want to configure. For demonstration purposes, we will generate sticky residential proxies. Set the session TTL longer than your planned run, because MediaCrawler needs the same IP from login to the last request.
From the Byteful dashboard, you can also choose the format your proxies are generated in. For MediaCrawler, you will need your proxy details in the URL format.

Byteful provides IP addresses from 195+ countries while supporting country- and city-level targeting. Once done with the targeting configuration, click "Generate", and you will get your sticky residential proxy details.

MediaCrawler works with HTTP proxies only. SOCKS5 proxies are not supported and result in an "Unsupported proxy scheme" error. The config also accepts a proxy URL that starts with https://, but MediaCrawler still connects to the proxy over plain HTTP, so use the http:// form of your proxy URL. Your traffic to the platform stays encrypted either way, because it passes through the proxy as HTTPS.
In the case of HTTPS proxies, it will work only if your proxy provider supports TLS tunneling for the proxies you are using. Ask your proxy provider to confirm that TLS tunneling is supported on your proxies. Byteful supports TLS tunneling on all four proxy types.
Note: Byteful now allows proxy connections to domain names only as a safeguard against network misuse. If your setup resolves domain names locally before sending traffic to the proxy, requests may fail. With MediaCrawler, use the HTTP/HTTPS proxy option, because SOCKS5 is not supported. If your use case needs direct IP access, you can unlock direct IP access after KYC verification.
Once you have your proxy details, you can configure them in MediaCrawler. To configure the proxy with MediaCrawler:
1. Open the project's /config/base_config.py file located in MediaCrawler’s root directory.
2. Set the ENABLE_IP_PROXY option to “True”, set IP_PROXY_PROVIDER_NAME to “static”, and enter your proxy URL in the STATIC_PROXY_URL. Follow the format http://username:password@host:port when using authenticated proxies, and for unauthenticated proxies, use http://host:port.

3. Finally, disable CDP mode by setting ENABLE_CDP_MODE = False. This is required because in CDP mode the browser does not use the proxy. Your login would go out through your own IP while the data requests go through the proxy. If you installed MediaCrawler with its default settings, Playwright's browser is not installed yet, so run the command “uv run playwright install” once before your next run.

Once done, your MediaCrawler crawl’s traffic will be routed through the proxy. MediaCrawler does not test a static proxy before using it, so test the proxy URL yourself before the first run.
You can check that it responds with Byteful Proxy Tester, or run curl -x "http://USER:PASS@PROXY_HOST:PROXY_PORT" https://httpbin.org/ip (on Windows PowerShell, use curl.exe). If the command returns the proxy's IP address instead of your own, the URL is correct, and the proxy is working.
If you do not want to include the proxy details in the configuration file, you can pass your proxy details along with the command as well. The following is a sample command that uses the proxy details defined in the command:
uv run main.py --platform xhs --lt qrcode --type search --enable_ip_proxy yes --ip_proxy_provider_name static --static_proxy_url "http://USER:PASS@PROXY_HOST:PROXY_PORT"Note: For this command to actually use the specified proxy, CDP mode still has to be set to false in the configuration file (ENABLE_CDP_MODE= False).
Additionally, you can whitelist your IP address in the provider’s dashboard to avoid including your proxy credentials in the configuration file.
Whitelist Your IP Address
To configure authenticated proxies with MediaCrawler without including your proxy credentials in the configuration file, you can whitelist your public IP in your provider’s dashboard.
Proxy IP whitelisting lets you skip credential authentication and authenticate your connection to the proxy server based on the whitelisted IP addresses. Many leading proxy providers support proxy IP whitelisting. Ask your provider to see if they support whitelisting for their proxies. Byteful supports proxy IP whitelisting for the datacenter and static residential proxies.
To whitelist your public IP address on the Byteful dashboard:
1. Use an IP-echo page like httpbin.org/ip to get your public IP address.
2. Log in to the dashboard.
3. Navigate to ‘Proxy Users’ from the left-side menu and click “Edit Authentication” for a proxy user.

4. In the edit proxy user pop-up, enter the IP address you got from the first step, hit “Enter”, and finally, click “Confirm”.

Once your public IP address is whitelisted in the proxy provider’s dashboard, you can skip the proxy credentials and configure your proxies using your proxy’s hostname and the port number (STATIC_PROXY_URL= http://PROXY_HOST:PROXY_PORT).
Method 2: A Custom MediaCrawler provider for multiple proxies
The proxy configuration explained so far allows you to configure a single proxy URL with MediaCrawler. But what if you have a list of multiple proxies that you want to use with MediaCrawler? This is exactly where configuring a custom MediaCrawler provider helps. With this approach, you can configure a list of proxies, and each MediaCrawler run picks one of them at random. You can also set an expiry time for each proxy, but leave it unset for most runs. When a proxy expires, MediaCrawler moves only its data requests to a new proxy, and the browser session stays on the old one.
To configure a custom MediaCrawler provider:
1. Create a .txt file in the MediaCrawler‘s root directory with a name of your choice. We will be using the name “proxies.txt”. Then paste the list of proxy URLs, one proxy URL per line. Be sure to include the proxy protocol as well.
2. Next, in the /proxy/providers directory of the project, create a .py file with the following code in it and give the file a name of your choice. We will be using the name “custom_provider.py”. This file will configure your custom MediaCrawler provider.
from pathlib import Path
from typing import List
from urllib.parse import urlparse
from proxy.base_proxy import ProxyProvider
from proxy.types import IpInfoModel
class CustomProvider(ProxyProvider):
def __init__(self):
self.file_path = Path("proxies.txt")
async def get_proxy(self, num: int) -> List[IpInfoModel]:
if not self.file_path.exists():
return []
urls = [
line.strip()
for line in self.file_path.read_text().splitlines()
if line.strip() and not line.startswith("#")
]
proxies: List[IpInfoModel] = []
for url in urls:
if len(proxies) >= num:
break
parsed = urlparse(url)
# Skip anything malformed instead of crashing
try:
host, port = parsed.hostname, parsed.port
except ValueError:
continue
if not host or not port:
continue
proxies.append(
IpInfoModel(
ip=host,
port=port,
user=parsed.username or "",
password=parsed.password or "",
protocol=f"{parsed.scheme}://",
expired_time_ts=None, #configure proxy expiration time
)
)
return proxies
def new_custom_provider() -> CustomProvider: # Modify based on your file name
return CustomProvider()3. Next, specify the name for your custom provider in the project’s /proxy/types.py file. Here, we are using the name “custom”.

4. Once done, add your custom provider to the MediaCrawler's dictionary that maps provider names to provider instances. You can do so by adding the import line “from proxy.providers.custom_provider import new_custom_provider” to the project’s /proxy/proxy_ip_pool.py file import statements.

5. Now, add the “ProviderNameEnum.CUSTOM_PROVIDER.value: new_custom_provider()” to IpProxyProvider’s dictionary in the same file. Remember that you will need to modify these statements based on the file name you choose for your .py file created earlier.

6. Once done, enable the IP proxy in the project’s config/base_config.py file and set IP_PROXY_POOL_COUNT to the number of proxies in your file. Set the IP_PROXY_PROVIDER_NAME to the name you chose earlier for your custom provider and disable the CDP mode.

7. Finally, test your configured custom provider by running a test command like “uv run main.py --platform dy --lt qrcode --type detail”. If the terminal log shows the line "testing <your proxy host> is it valid" with no error after it, your custom provider is working, and the run is using a proxy from your list.

Crawl Responsibly With MediaCrawler
MediaCrawler is built only for learning and research purposes. The project’s owner clearly prohibits using it for large-scale crawling, any commercial use, or other illegal activities. All of this is clearly stated in the project’s disclaimer, and by using the project or any content of this project, you agree to all of the terms and conditions stated in that disclaimer.
Use MediaCrawler to collect only content that people have posted publicly, and do not collect personal data such as names or phone numbers. Keep each run small and well-paced.
MediaCrawler's default settings already help here: CRAWLER_MAX_NOTES_COUNT caps how many posts each keyword search collects, MAX_CONCURRENCY_NUM runs one task at a time, and CRAWLER_MAX_SLEEP_SEC adds a pause of at least 2 seconds between requests. Leave these limits in place. If a platform refuses a request, stop the run instead of retrying around it. Store only the data your research needs and delete the rest.
While using MediaCrawler on any site, respect the site’s terms of use and the local law. When using a proxy with MediaCrawler, its sole purpose should be to keep a well-paced crawl stable and prevent collateral blocks on a shared home or office IP. Do not use it to bypass rate limits or violate the platform’s terms of use.
Troubleshooting Proxy Issues in MediaCrawler
You might face some problems when configuring proxies with MediaCrawler. This section lists some of the most common ones along with the solution:
- The browser logs out mid-run: This can happen if your proxy IP changes mid-crawl. The IP has to be consistent from the login till all subsequent data requests. To make sure that the proxy IP remains consistent, use a static or a sticky proxy with a Time to Live (TTL) longer than the crawl time.
- The proxy is not being used after the configuration: Make sure that ENABLE_IP_PROXY in the project's config/base_config.py file is set to True. In CDP mode, the browser does not use the proxy, so set ENABLE_CDP_MODE = False as well.
- The terminal logs say that the proxy is invalid: This check runs only with a custom provider. It means the test request through the proxy failed. Common causes are a wrong host, port, or credentials, an IP that is not whitelisted, or the test request timing out. Check your proxy URL and confirm the proxy is active with Byteful Proxy Tester. With the static option, MediaCrawler does not test the proxy first, so the same mistakes show up as a failed login page or a timeout.
- Hitting playwright.TimeoutError: First, confirm that the proxy itself works, because a wrong or dead proxy also makes page loads time out. If the proxy works but is slow, give the page more time. The 30000 ms limit is Playwright's default, and MediaCrawler does not set its own value. To raise it, add a timeout to the page load call in /media_platform/<platform>/core.py, as shown below.

- Getting an ‘unsupported proxy scheme’ error: The main reason for this error is that you are using a SOCKS5 proxy. MediaCrawler does not support using SOCKS5 proxies. Use an HTTP proxy URL that starts with http:// instead.
Which Proxy To Use With MediaCrawler
Each proxy type differs in the way it is sourced, routes traffic, and IP consistency. For MediaCrawler, choose the one that holds the same IP for at least as long as the crawl is running. That is because the tool logs in through a Playwright browser and reuses that authenticated session for the subsequent data requests. An IP change between the two stages can break the authentication.
- Datacenter proxies: These are usually the cheapest and fastest type. A dedicated datacenter proxy is a fixed IP, so no session settings are needed. They suit a test run, but not the crawl itself, because platforms tend to limit traffic from datacenter ranges sooner.
- Static residential ISP proxies: These IPs are registered to real ISPs but hosted in datacenters, so you get one fixed IP with datacenter speed. That makes them the simplest fit for MediaCrawler. The tool also saves your login between runs by default, and a fixed IP keeps that login on the same address every time.
- Residential proxies: These IPs come from real home devices and rotate by default, so use a sticky session with a TTL longer than the crawl. The IP can still change early if its device goes offline, so choose static residential for long runs. They are billed by data used, so leave media downloads (ENABLE_GET_MEDIA) off unless you need the files.
Byteful offers ethically sourced proxies compatible with MediaCrawler. The two that fit best are our sticky residential sessions, where you set the session TTL yourself, and our static residential proxies, which keep one fixed IP across runs and support IP whitelisting. For this tool, a stable session matters more than pool size.
You can also test our proxies with our no-credit-card 1 GB of free, non-expiring residential data. You can get the trial data after signing up on the dashboard and completing a short KYC. We ask for KYC before the trial so that the free data goes to genuine users, which helps keep the pool clean for everyone.


