diff options
| author | emkael <emkael@tlen.pl> | 2016-03-10 16:11:12 +0100 |
|---|---|---|
| committer | emkael <emkael@tlen.pl> | 2016-03-10 16:11:12 +0100 |
| commit | dc6b46f32874ad97ef2c644a824ac3dc16382586 (patch) | |
| tree | db8df11175aec4a7684707d15f4e6bd43081de79 /bin | |
| parent | 4faae2d037efc21291c1031c9fd7b4c67bb25741 (diff) | |
* switching to r/MotorsportCalendar wiki page instead of stickied thread
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/import_cals.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/import_cals.py b/bin/import_cals.py index 8b32691..ef49e89 100644 --- a/bin/import_cals.py +++ b/bin/import_cals.py @@ -29,7 +29,7 @@ def get_cal_list(): opener = urllib2.build_opener() opener.addheaders = [('User-Agent', CONFIG['user_agent'])] cal_list = json.loads(opener.open(CONFIG['reddit_url']).read()) - cal_list = cal_list[0]['data']['children'][0]['data']['selftext'] + cal_list = cal_list['data']['content_md'] with open(cache_path, 'w') as cache_file: cache_file.write(cal_list) cache_file.close() @@ -69,7 +69,7 @@ def update_calendar(cal, session): def get_imported_calendars(cells, ical_markdown): imported_calendars = [] for row in cells: - row = [r for r in row if r] + row = [r for r in row if r.strip()] if len(row) == 5: markdown_match = re.match(ical_markdown, row[2]) if markdown_match: @@ -82,7 +82,7 @@ def get_imported_calendars(cells, ical_markdown): 'uid': ical_path[0], 'url': ical_url.geturl(), 'name': row[0], - 'website': row[4], + 'website': row[4].split()[0], 'category': row[1] }) else: |
