twscrape icon indicating copy to clipboard operation
twscrape copied to clipboard

Proxy issue

Open sicholas opened this issue 10 months ago • 5 comments

Have tried many proxy providers but haven't been able to get a single one to work with TWScrape. I receive no errors, just the scripts never do anything and sit there.

I have been adding proxies as so (have tried socks5, HTTP, and HTTPS):

async def add_proxy_to_account(api, account, proxy):
    username, password, email, email_password, cookie = account.split(':')
    proxy_url = proxy
    # print(proxy)
    await api.pool.add_account(username, password, email, email_password, cookies=cookie, proxy=proxy_url)
    print(f"Added proxy to account: {username}")

Thanks!

sicholas avatar Apr 25 '24 15:04 sicholas

fwiw, i've been able to use a proxy server without a problem. have you tried to do it globally. something like:

tw_scrape_db = os.path.join(os_path, "accounts.db") token_pool = AccountsPool(db_file=tw_scrape_db) tw_scrape_api = API(pool=token_pool, proxy=proxy_url)

takabinance avatar Apr 26 '24 01:04 takabinance

fwiw, i've been able to use a proxy server without a problem. have you tried to do it globally. something like:

tw_scrape_db = os.path.join(os_path, "accounts.db") token_pool = AccountsPool(db_file=tw_scrape_db) tw_scrape_api = API(pool=token_pool, proxy=proxy_url)

Sorry for the delayed response. What provider do you use and what type of proxy are you using (HTTP, HTTPS, SOCKS5)? Thanks again!

sicholas avatar Jun 17 '24 02:06 sicholas

I've used royal and stormproxies. I settled on stormproxies residential as it's cheap, unlimited bandwidth and twitter doesn't seem to ban it so quickly. Http

takabinance avatar Jun 17 '24 02:06 takabinance

@takabinance thank you so much and storm does rotating residential? So every request is randomized or are you just buying one singular static resi?

sicholas avatar Jun 17 '24 02:06 sicholas

I think it rotates every 5 mins. They have a data center service that rotates on every request but felt like that was getting banned too often.

takabinance avatar Jun 17 '24 03:06 takabinance