Commit 6e484b55 authored by andytnt's avatar andytnt

Fix search query

parent a937c8fc
...@@ -106,6 +106,7 @@ def initialize(args): ...@@ -106,6 +106,7 @@ def initialize(args):
c.Proxy_type = args.proxy_type c.Proxy_type = args.proxy_type
c.ES_count = {"likes":True, "replies":True, "retweets":True} c.ES_count = {"likes":True, "replies":True, "retweets":True}
c.Retweets = args.retweets c.Retweets = args.retweets
c.Query = args.query
return c return c
def options(): def options():
...@@ -187,6 +188,7 @@ def options(): ...@@ -187,6 +188,7 @@ def options():
ap.add_argument("--replies", help="Display replies to a subject.", action="store_true") ap.add_argument("--replies", help="Display replies to a subject.", action="store_true")
ap.add_argument("-pc", "--pandas-clean", ap.add_argument("-pc", "--pandas-clean",
help="Automatically clean Pandas dataframe at every scrape.") help="Automatically clean Pandas dataframe at every scrape.")
ap.add_argument("--query", help="Search query")
args = ap.parse_args() args = ap.parse_args()
return args return args
...@@ -198,7 +200,7 @@ def main(): ...@@ -198,7 +200,7 @@ def main():
check(args) check(args)
if args.userlist: if args.userlist:
args.username = loadUserList(args.userlist, "search") args.query = loadUserList(args.userlist, "search")
if args.pandas_clean: if args.pandas_clean:
twint.storage.panda.clean() twint.storage.panda.clean()
......
...@@ -56,3 +56,4 @@ class Config: ...@@ -56,3 +56,4 @@ class Config:
Proxy_port = 0 Proxy_port = 0
Proxy_type = None Proxy_type = None
Retweets = False Retweets = False
Query = None
...@@ -67,6 +67,8 @@ async def Search(config, init): ...@@ -67,6 +67,8 @@ async def Search(config, init):
if config.Lang: if config.Lang:
params.append(("l", config.Lang)) params.append(("l", config.Lang))
params.append(("lang", "en")) params.append(("lang", "en"))
if config.Query:
q += f"from:{config.Query}"
if config.Username: if config.Username:
q += f"from:{config.Username}" q += f"from:{config.Username}"
if config.Geo: if config.Geo:
......
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