Commit 574805b3 authored by Francesco Poldi's avatar Francesco Poldi

Added native_retweets #492

parent c081834c
VERSION = (1, 2, 6) VERSION = (1, 2, 7)
__version__ = '.'.join(map(str, VERSION)) __version__ = '.'.join(map(str, VERSION))
...@@ -115,6 +115,7 @@ def initialize(args): ...@@ -115,6 +115,7 @@ def initialize(args):
c.Popular_tweets = args.popular_tweets c.Popular_tweets = args.popular_tweets
c.Skip_certs = args.skip_certs c.Skip_certs = args.skip_certs
c.Hide_output = args.hide_output c.Hide_output = args.hide_output
c.Native_retweets = args.native_retweets
return c return c
def options(): def options():
...@@ -200,6 +201,7 @@ def options(): ...@@ -200,6 +201,7 @@ def options():
ap.add_argument("-pt", "--popular-tweets", help="Scrape popular tweets instead of recent ones.", action="store_true") ap.add_argument("-pt", "--popular-tweets", help="Scrape popular tweets instead of recent ones.", action="store_true")
ap.add_argument("-sc", "--skip-certs", help="Skip certs verification, useful for SSC.", action="store_false") ap.add_argument("-sc", "--skip-certs", help="Skip certs verification, useful for SSC.", action="store_false")
ap.add_argument("-ho", "--hide-output", help="Hide output, no tweets will be displayed.", action="store_true") ap.add_argument("-ho", "--hide-output", help="Hide output, no tweets will be displayed.", action="store_true")
ap.add_argument("-nr", "--native-retweets", help="Filter the results for retweets only.", action="store_true")
args = ap.parse_args() args = ap.parse_args()
return args return args
......
...@@ -64,4 +64,5 @@ class Config: ...@@ -64,4 +64,5 @@ class Config:
Near = "" Near = ""
Custom_query = "" Custom_query = ""
Popular_tweets = False Popular_tweets = False
Skip_certs = False Skip_certs = False
\ No newline at end of file Native_retweets = False
\ No newline at end of file
...@@ -32,7 +32,7 @@ def Tweet(config, t): ...@@ -32,7 +32,7 @@ def Tweet(config, t):
logme.debug(__name__+':Tweet:notFormat') logme.debug(__name__+':Tweet:notFormat')
output = f"{t.id_str} {t.datestamp} {t.timestamp} {t.timezone} " output = f"{t.id_str} {t.datestamp} {t.timestamp} {t.timezone} "
if t.retweet == 1: if t.retweet:
output += "RT " output += "RT "
output += f"<{t.username}> {t.tweet}" output += f"<{t.username}> {t.tweet}"
......
...@@ -92,7 +92,8 @@ def Tweet(tw, config): ...@@ -92,7 +92,8 @@ def Tweet(tw, config):
t.likes_count = getStat(tw, "favorite") t.likes_count = getStat(tw, "favorite")
t.link = f"https://twitter.com/{t.username}/status/{t.id}" t.link = f"https://twitter.com/{t.username}/status/{t.id}"
t.retweet = getRetweet(config.Profile, t.username, config.Username) t.retweet = getRetweet(config.Profile, t.username, config.Username)
if t.retweet: if t.retweet or config.Native_retweets:
t.retweet = True
t.user_rt_id = config.User_id t.user_rt_id = config.User_id
else: else:
t.user_rt_id = 0 t.user_rt_id = 0
......
...@@ -109,6 +109,8 @@ async def Search(config, init): ...@@ -109,6 +109,8 @@ async def Search(config, init):
q += " filter:media" q += " filter:media"
if config.Replies: if config.Replies:
q += " filter:replies" q += " filter:replies"
if config.Native_retweets:
q += " filter:nativeretweets"
if config.Custom_query: if config.Custom_query:
q = config.Custom_query q = config.Custom_query
......
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