def get_items (feed_url, strip_parameters=True):
    """Get the item titles and links from this feed_url,
    display them according to OUTPUT_FORMAT in stdout,
    and return a dict of item number and item url,
    to allow someone to drill down to a specific article."""

    titles = filter(None, item_titles(feed_url))
    links  = filter(None, item_links(feed_url, strip_parameters))

    if len(titles) == 0 or len(links) == 0:
        print "Sorry, there's nothing available right now at", feed_url

    output = []
    posts = {} # k=item number (starting at 1), v=item url
    for i, title in enumerate(titles):
        try:
            output.append(OUTPUT_FORMAT.substitute(num=(i+1),
                                                   title=title,
                                                   link=links[i]))
            posts[(i+1)] = str(links[i].encode('utf-8'))
        except __HOLE__:
            pass
    return u''.join(output), posts
dataset/ETHPy150Open dpapathanasiou/cmdline-news/cmdlinenews.py/get_items