def parse(self): """ Consume the feed. """ feed = feedparser.parse(self.rss_url) for entry in feed.entries: entry['published_parsed'] = str(entry.get('published_parsed')) entry['thumbnail'] = Image.get_smallest_image(entry.media_thumbnail) if len(entry.media_content) > 0: entry['duration'] = Video.get_duration(entry.media_content[0]) entry['video_codec'] = Video.get_codec(entry.media_content[0]) entry['bitrate'] = Video.get_bitrate(entry.media_content[0]) return feed.entries
def test_bad_get_codec(self): video = self.video.copy() video.pop('type') codec = Video.get_codec(video) self.assertIsNone(codec)
def test_get_codec(self): codec = Video.get_codec(self.video) self.assertEqual(codec, 'quicktime/mov')