diff options
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: |