コード例 #1
0
def scrape_description(url, shortmem=None):
    try:
        details = shortmem['base_etree'].xpath(
            "//span[@id='video-description']")[0]
        return util.clean_description_html(util.lxml_inner_html(details))
    except IndexError:
        raise errors.FieldNotFound('Could not find the description field')
コード例 #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')
コード例 #3
0
def scrape_title(url, shortmem={}):
    try:
        return shortmem['feed_item']['title']
    except KeyError:
        raise errors.FieldNotFound('Could not find the title field')
コード例 #4
0
def scrape_publish_date(url, shortmem={}):
    # sure it's not exactly the publish date, but it's close
    try:
        return shortmem['feed_item'].updated_parsed
    except KeyError:
        raise errors.FieldNotFound('Could not find the publish_date field')
コード例 #5
0
def scrape_title(url, shortmem=None):
    try:
        return shortmem['base_etree'].xpath(
            "//div[@id='video-title']/text()")[0]
    except IndexError:
        raise errors.FieldNotFound('Could not find the title field')