Commit 3d81c4fb authored by Francesco Poldi's avatar Francesco Poldi

Human readble query #320

parent 9cfaedee
...@@ -74,7 +74,7 @@ async def RequestUrl(config, init, headers = []): ...@@ -74,7 +74,7 @@ async def RequestUrl(config, init, headers = []):
response = await Request(_url, connector=_connector, headers=headers) response = await Request(_url, connector=_connector, headers=headers)
elif config.TwitterSearch: elif config.TwitterSearch:
logme.debug(__name__+':RequestUrl:TwitterSearch') logme.debug(__name__+':RequestUrl:TwitterSearch')
_url, params = await url.Search(config, init) _url, params, _serialQuery = await url.Search(config, init)
response = await Request(_url, params=params, connector=_connector, headers=headers) response = await Request(_url, params=params, connector=_connector, headers=headers)
else: else:
if config.Following: if config.Following:
...@@ -89,7 +89,7 @@ async def RequestUrl(config, init, headers = []): ...@@ -89,7 +89,7 @@ async def RequestUrl(config, init, headers = []):
response = await MobileRequest(_url, connector=_connector) response = await MobileRequest(_url, connector=_connector)
if config.Debug: if config.Debug:
print(_url, file=open("twint-request_urls.log", "a", encoding="utf-8")) print(_serialQuery, file=open("twint-request_urls.log", "a", encoding="utf-8"))
return response return response
......
...@@ -2,6 +2,13 @@ import logging as logme ...@@ -2,6 +2,13 @@ import logging as logme
mobile = "http://mobile.twitter.com" mobile = "http://mobile.twitter.com"
base = "http://twitter.com/i" base = "http://twitter.com/i"
def _sanitizeQuery(base,params):
_serialQuery = ""
for p in params:
_serialQuery += p[0]+"="+p[1]+"&"
_serialQuery = base + "?" + _serialQuery[:-1].replace(":", "%3A").replace(" ", "%20")
return _serialQuery
async def Favorites(username, init): async def Favorites(username, init):
logme.debug(__name__+':Favorites') logme.debug(__name__+':Favorites')
url = f"{mobile}/{username}/favorites?lang=en" url = f"{mobile}/{username}/favorites?lang=en"
...@@ -105,4 +112,5 @@ async def Search(config, init): ...@@ -105,4 +112,5 @@ async def Search(config, init):
q = config.Custom_query q = config.Custom_query
params.append(("q", q)) params.append(("q", q))
return url, params _serialQuery = _sanitizeQuery(url, params)
return url, params, _serialQuery
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