Example #1
0
def scrape_file_url(url, shortmem={}):
    try:
        video_enclosure = miroguide_util.get_first_video_enclosure(
            shortmem['feed_item'])
        if video_enclosure is not None:
            return video_enclosure.get('url')
    except KeyError:
        raise errors.FieldNotFound('Could not find the feed_item field')
Example #2
0
def scrape_file_url(url, shortmem={}):
    try:
        video_enclosure = miroguide_util.get_first_video_enclosure(
            shortmem['feed_item'])
        if video_enclosure is not None:
            return video_enclosure.get('url')
    except KeyError:
        raise errors.FieldNotFound('Could not find the feed_item field')
Example #3
0
def video_count(feed_url, parsed_feed=None):
    """
    Takes a URL for a feed, and returns the number of videos we think we can
    import from it.
    """
    if parsed_feed is None:
        parsed_feed = feedparser.parse(feed_url)
    for importer in IMPORTERS:
        count = importer.video_count(parsed_feed)
        if count is not None:
            return count

    count = 0
    for entry in parsed_feed.entries:
        if miroguide_util.get_first_video_enclosure(entry) is not None:
            count += 1
    return count
Example #4
0
def video_count(feed_url, parsed_feed=None):
    """
    Takes a URL for a feed, and returns the number of videos we think we can
    import from it.
    """
    if parsed_feed is None:
        parsed_feed = feedparser.parse(feed_url)
    for importer in IMPORTERS:
        count = importer.video_count(parsed_feed)
        if count is not None:
            return count

    count = 0
    for entry in parsed_feed.entries:
        if miroguide_util.get_first_video_enclosure(entry) is not None:
            count += 1
    return count