def see_url(browser: str, email: str, pw: str): log = Log(error_path='error.log', debug_path='normal.log', json_path='info.log') log.set_level(Log.stdout_level) # for test log.debug('test ' + browser + '_' + email) start = time.time() crawler = FacebookCrawler(user_name=email, password=pw, log=log, browser=browser) crawler.init() log.debug('init') crawler.login_facebook() log.debug('login') crawler.set_sleep(1) # info_dict = crawler.open_homepage_by_param(name='الزجوي عبدلاه', city='Cairo', country_code='EG') # print(info_dict) # info_dict = crawler.open_homepage_by_param(name='Angel Gunawan', city='Surabaya', country_code='ID') # print(info_dict) info_dict = crawler.open_homepage_by_param(name='Arman Ali', city='Gorakhpur', country_code='IN') print(info_dict) # info_dict = crawler.open_homepage_by_param(name='Jose Antonio Lara Gálvez', city='Jerez de la Frontera', # country_code='ES') # print(info_dict) # info_dict = crawler.open_homepage_by_param(name='Elena Iuliana', city='Bucharest', country_code='RO') # print(info_dict) end = time.time() log.debug('time cost:' + str(end - start) + ' s')
def browser_param(browser: str, email: str, pw: str): log = Log(error_path='error.log', debug_path='normal.log', json_path='info.log') log.set_level(Log.stdout_level) # for test log.debug('test ' + browser + '_' + email) start = time.time() crawler = FacebookCrawler(user_name=email, password=pw, log=log, browser=browser) crawler.init() crawler.login_facebook() # crawler.get_browser().save_screenshot('login.png') crawler.set_sleep(1) user_url = 'https://www.facebook.com/app_scoped_user_id/1758044224504993/' user_info = crawler.open_homepage_by_url(user_homepage=user_url) log.debug(user_info) end = time.time() log.debug('time cost:' + str(end - start) + ' s')