-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
55 lines (38 loc) · 1.32 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""main.py
This script runs the Facebook crawler (infinitely) and dumps the data to disk as JSON.
Example
-------
Script can be executed as following::
$ python main.py --email <email id> --password <password>'
"""
__author__ = "Ali Raza"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "Ali Raza"
__email__ = "[email protected]"
__status__ = "Development"
import argparse
from crawler.fb_activity_crawler import ActiveBuddiesCrawler
from util.selenium_util import Browser
def argument_parser():
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--email', type=str, help='Email id for Facebook')
parser.add_argument('--password', type=str, help='Password for Facebook')
return parser.parse_args()
if __name__ == "__main__":
args = argument_parser()
if args.email is None or args.password is None:
print('Usage: python main.py --email <email id> --password <password>')
exit(1)
driver_path = './lib/chromedriver'
browser = Browser(driver_path, init=True)
log_dir = './logs'
dump_dir = './dumped_data'
crawler = ActiveBuddiesCrawler(browser, {
"email": args.email,
"password": args.password
}, dump_dir, log_dir)
crawler.login()
crawler.crawl()