Add argument to skip scraping and just spit out a graph
This commit is contained in:
parent
65a5a5c63b
commit
3588e5937f
13
scrape.py
13
scrape.py
@ -43,6 +43,16 @@ from selenium.webdriver.support import expected_conditions
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
from bs4 import BeautifulSoup
|
||||
from collections import Counter
|
||||
from argparse import ArgumentParser
|
||||
|
||||
##### Parse arguments #######################################
|
||||
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('-d', '--dump', help='skip scraping and process whatever is shelved', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.dump:
|
||||
print('Dump option specified, will skip scraping')
|
||||
|
||||
##### Set up NetworkX #######################################
|
||||
|
||||
@ -52,6 +62,7 @@ print('NetworkX initialised')
|
||||
|
||||
##### Set up WebDriver with Chrome ##########################
|
||||
|
||||
if not args.dump:
|
||||
chrome_options = Options()
|
||||
|
||||
# Start headless so we can run on a server overnight
|
||||
@ -343,7 +354,7 @@ with shelve.open('shelf.db') as shelf:
|
||||
if 'iterator' in shelf.keys():
|
||||
iterator = shelf['iterator']
|
||||
|
||||
|
||||
if not args.dump:
|
||||
while iterator <= MAX_DEGREE:
|
||||
for user_str in users_to_process:
|
||||
print('Processing ' + user_str + ' (distance ' + str(iterator) + ')')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user