diff --git a/ofscraper/utils/args.py b/ofscraper/utils/args.py index 4739f6ea5..589c15d8b 100644 --- a/ofscraper/utils/args.py +++ b/ofscraper/utils/args.py @@ -242,33 +242,36 @@ def getargs(input=None): - - parser=create_parser(input) - - args=parser.parse_args(input) - - - #fix args - args.posts=list(set(args.posts or [])) - args.excluded_post=list(set(args.excluded_posts or [])) - args.username=set(args.username or []) - args.excluded_username=set( args.excluded_username or []) - args.label=set(args.label) if args.label else args.label - args.black_list=set(list(map(lambda x:x.lower(),args.black_list))) - if len(args.user_list)==0:args.user_list={constants.OFSCRAPER_RESERVED_LIST} - else:args.user_list=set(list(map(lambda x:x.lower(),args.user_list))) - + try: + parser=create_parser(input) - - - if args.command in set(["post_check","msg_check"])and not (args.url or args.file): - raise argparse.ArgumentTypeError("error: argument missing --url or --file must be specified )") - elif args.command in set(["story_check","paid_check"])and not (args.username or args.file): - raise argparse.ArgumentTypeError("error: argument missing --username or --file must be specified )") - elif args.command in set(["manual"])and not (args.url or args.file): - raise argparse.ArgumentTypeError("error: argument missing --url or --file must be specified )") - print(args) - sys.exit() + args=parser.parse_args(input) + + + #fix args + args.posts=list(set(args.posts or [])) + args.excluded_post=list(set(args.excluded_posts or [])) + args.username=set(args.username or []) + args.excluded_username=set( args.excluded_username or []) + args.label=set(args.label) if args.label else args.label + args.black_list=set(list(map(lambda x:x.lower(),args.black_list))) + if len(args.user_list)==0:args.user_list={constants.OFSCRAPER_RESERVED_LIST} + else:args.user_list=set(list(map(lambda x:x.lower(),args.user_list))) + + + + + if args.command in set(["post_check","msg_check"])and not (args.url or args.file): + raise argparse.ArgumentTypeError("error: argument missing --url or --file must be specified )") + elif args.command in set(["story_check","paid_check"])and not (args.username or args.file): + raise argparse.ArgumentTypeError("error: argument missing --username or --file must be specified )") + elif args.command in set(["manual"])and not (args.url or args.file): + raise argparse.ArgumentTypeError("error: argument missing --url or --file must be specified )") + print(args) + sys.exit() + except Exception as E: + print(E) + sys.exit() return args