adding twarc_command argument
@@ -68,6 +68,9 @@ def main():
parser.add_argument("--tweet_mode", action="store", default="compat",
dest="tweet_mode", choices=["compat", "extended"],
help="set tweet mode")
+ parser.add_argument("--twarc_command", action="store", default="search",
+ dest="twarc_command", choices=["search", "timeline"],
+ help="select twarc command to be used for harvest, currently supports search and timeline")
args = parser.parse_args()
@@ -105,9 +108,9 @@ def main():
last_archive = get_last_archive(args.archive_dir)
if last_archive:
last_id = json.loads(next(open(last_archive)))['id_str']
- tweets = t.search(args.search, since_id=last_id)
+ tweets = getattr(t, args.twarc_command)(args.search, since_id=last_id)
else:
- tweets = t.search(args.search)
+ tweets = getattr(t, args.twarc_command)(args.search)
next_archive = get_next_archive(args.archive_dir)
@@ -153,5 +156,3 @@ def get_next_archive(archive_dir):
if __name__ == "__main__":
main()
-
-
