try to stop errors accessing non-existent field link.type

This commit is contained in:
Kyle Mahan 2016-06-02 23:07:08 -07:00
parent 3a1d88616c
commit 71be267613

View file

@ -427,11 +427,11 @@ def process_xml_feed_for_new_entries(feed, content, backfill, now):
title = None title = None
for link in p_entry.get('links', []): for link in p_entry.get('links', []):
if link.type == 'audio/mpeg' or link.type == 'audio/mp3': link_type = link.get('type')
if link_type in ['audio/mpeg', 'audio/mp3']:
audio = AUDIO_ENCLOSURE_TMPL.format(href=link.get('href')) audio = AUDIO_ENCLOSURE_TMPL.format(href=link.get('href'))
content = (content or '') + audio content = (content or '') + audio
if (link.type == 'video/x-m4v' or link.type == 'video/x-mp4' or if link_type in ['video/x-m4v', 'video/x-mp4', 'video/mp4']:
link.type == 'video/mp4'):
video = VIDEO_ENCLOSURE_TMPL.format(href=link.get('href')) video = VIDEO_ENCLOSURE_TMPL.format(href=link.get('href'))
content = (content or '') + video content = (content or '') + video