Commit 80d5ded6 authored by Francesco Poldi's avatar Francesco Poldi

Enhancement for workaround

Select the working of the workaround's UA only for tweets, for followers/following use the old method that still works
parent 46d29045
......@@ -148,12 +148,12 @@ async def Response(session, url, params=[]):
async with session.get(url, ssl=True, params=params, proxy=httpproxy) as response:
return await response.text()
async def RandomUserAgent():
async def RandomUserAgent(wa=None):
logme.debug(__name__+':RandomUserAgent')
try:
#ua = UserAgent(verify_ssl=False, use_cache_server=False)
ua = "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36"
return ua
if wa:
return "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36"
return UserAgent(verify_ssl=False, use_cache_server=False).random
except:
return random.choice(user_agent_list)
......
......@@ -150,7 +150,10 @@ class Twint:
await task
async def run(self):
self.user_agent = await get.RandomUserAgent()
if self.config.TwitterSearch:
self.user_agent = await get.RandomUserAgent(wa=True)
else:
self.user_agent = await get.RandomUserAgent()
if self.config.User_id is not None:
logme.debug(__name__+':Twint:main:user_id')
self.config.Username = await get.Username(self.config.User_id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment