Skip to content

Commit

Permalink
Fixed bugs again
Browse files Browse the repository at this point in the history
  • Loading branch information
Pold87 committed Feb 17, 2016
1 parent cf892b3 commit 8107322
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions extract_occurrences.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_num_results(search_term, start_date, end_date):
div_results = soup.find("div", {"id": "gs_ab_md"}) # find line 'About x results (y sec)

if div_results != None:
res = re.findall(r'\s(\d+),?(\d+)?\s', div_results.text) # extract number of search results
res = re.findall(r'(\d+),?(\d+)?\s', div_results.text) # extract number of search results
num_results = ''.join(res[0]) # convert string to number
success = True
else:
Expand All @@ -41,7 +41,7 @@ def get_range(search_term, start_date, end_date):
fp.write("year,results\n")
print("year,results")

for date in range(start_date, end_date):
for date in range(start_date, end_date + 1):

num_results, success = get_num_results(search_term, date, date)
if not(success):
Expand Down
17 changes: 16 additions & 1 deletion out.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
year,results
2014,8260
2000,3
2001,5
2002,7
2003,5
2004,7
2005,12
2006,12
2007,40
2008,35
2009,43
2010,100
2011,141
2012,292
2013,889
2014,2370
2015,2580

0 comments on commit 8107322

Please sign in to comment.