Skip to content

Commit

Permalink
fixed missing regex
Browse files Browse the repository at this point in the history
  • Loading branch information
volpino committed Jun 18, 2012
1 parent a888796 commit aa1763b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions download_event_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ def get_event_date(title, csv_writer, lang):
pages = result["query"]["pages"]
for page in pages:
content = pages[page]["revisions"][0]["*"]
date = ""
dates = []
for line in content.split("\n"):
if re.match("", line):
result = re.search("(\d{4})", line)
if result:
date = result.group(0)
csv_writer.writerow([title, date])
result = re.search("date\s+?\=(.*)", line)
if result:
data = result.group(0)
if data:
result = re.search("(\d{4})", data)
if result:
dates.append(result.group(0))
csv_writer.writerow([title, " ".join(set(dates))])


def main():
Expand Down

0 comments on commit aa1763b

Please sign in to comment.