def _create_settings(args, parser, reddit): """ Create settings for each user input. Calls methods from an external modules: GetPRAWScrapeSettings().create_list() Validation.validate() GetPRAWScrapeSettings().get_settings() Global.make_list_dict() Parameters ---------- args: Namespace Namespace object containing all arguments that were defined in the CLI parser: ArgumentParser argparse ArgumentParser object reddit: Reddit object Reddit instance created by PRAW API credentials Returns ------- s_master: dict Dictionary containing all scrape settings """ sub_list = GetPRAWScrapeSettings().create_list(args, "subreddit") not_subs, subs = Validation.validate(sub_list, reddit, "subreddit") s_master = make_list_dict(subs) GetPRAWScrapeSettings().get_settings(args, not_subs, s_master, "subreddit") return s_master
def run(args, parser, reddit): """ Run comments scraper. Calls previously defined public methods: CheckSubmissions.list_submissions() Write.write() Calls public methods from external modules: GetPRAWScrapeSettings().create_list() GetPRAWScrapeSettings().get_settings() Global.make_none_dict() PRAWTitles.c_title() Parameters ---------- args: Namespace Namespace object containing all arguments that were defined in the CLI parser: ArgumentParser argparse ArgumentParser object reddit: Reddit object Reddit instance created by PRAW API credentials Returns ------- c_master: dict Dictionary containing all submission comments scrape settings """ PRAWTitles.c_title() post_list = GetPRAWScrapeSettings().create_list(args, s_t[2]) not_posts, posts = CheckSubmissions.list_submissions( parser, post_list, reddit) c_master = make_none_dict(posts) GetPRAWScrapeSettings().get_settings(args, not_posts, c_master, s_t[2]) Write.write(args, c_master, reddit) return c_master
def run(args, parser, reddit): """ Get, sort, then write scraped Redditor information to CSV or JSON. Calls a previously defined public method: Write.write() Calls public methods from external modules: GetPRAWScrapeSettings().create_list() Validation.validate() Global.make_none_dict() GetPRAWScrapeSettings().get_settings() Parameters ---------- args: Namespace Namespace object containing all arguments that were defined in the CLI parser: ArgumentParser argparse ArgumentParser object reddit: Reddit object Reddit instance created by PRAW API credentials Returns ------- u_master: dict Dictionary containing all Redditor scrape settings """ PRAWTitles.u_title() user_list = GetPRAWScrapeSettings().create_list(args, "redditor") not_users, users = Validation.validate(user_list, parser, reddit, "redditor") u_master = make_none_dict(users) GetPRAWScrapeSettings().get_settings(args, not_users, u_master, "redditor") Write.write(args, reddit, u_master) return u_master
def _create_settings(args, parser, reddit, s_t): """ Create settings for each user input. Calls previously defined private methods: CheckSubreddits.list_subreddits() Calls methods from an external modules: GetPRAWScrapeSettings().create_list() GetPRAWScrapeSettings().get_settings() Global.make_list_dict() Parameters ---------- args: Namespace Namespace object containing all arguments that were defined in the CLI parser: ArgumentParser argparse ArgumentParser object reddit: Reddit object Reddit instance created by PRAW API credentials s_t: list List of scraper types Returns ------- s_master: dict Dictionary containing all scrape settings """ sub_list = GetPRAWScrapeSettings().create_list(args, s_t[0]) not_subs, subs = CheckSubreddits.list_subreddits(parser, reddit, s_t, sub_list) s_master = make_list_dict(subs) GetPRAWScrapeSettings().get_settings(args, not_subs, s_master, s_t[0]) return s_master