I'm getting an List index out of range error for an index that exist
<p>Im using feed parser to obtain rss objects. When I run </p>

<pre><code>live_leak.links
</code></pre>

<p>I get</p>

<pre><code>[{'type': 'text/html', 'rel': 'alternate', 'href': 
'http://www.liveleak.com/view?i=abf_1476121939'}, 

{'type': 'application/x-shockwave-flash', 'rel': 'enclosure', 'href':
 'http://www.liveleak.com/e/abf_1476121939'}]
</code></pre>

<p>But when i try this</p>

<pre><code>live_leak.links[1]
</code></pre>

<p>I get list index out of range, mind you this was working earlier then all of a sudden this didn't work. I had this in my code and it took me hours to find because I didn't realize it was this that wasn't working. If no one knows I'll do a string replace as a hack but I rather do what was already working.</p>

<p>this also works </p>

<pre><code>live_leak[0]
</code></pre>

<p>it returns</p>

<pre><code>[{'type': 'text/html', 'rel': 'alternate', 'href': 
'http://www.liveleak.com/view?i=abf_1476121939'}]
</code></pre>

<p>which is weird because the other one won't work</p>

<h1>EDIT</h1>

<pre><code>def pan_task():
        url = 'http://www.liveleak.com/rss?featured=1'
        name = 'live leak'
        live_leaks = [i for i in feedparser.parse(url).entries]
        the_count = len(live_leaks)
        ky = feedparser.parse(url).keys()
        oky = [i.keys() for i in feedparser.parse(url).entries][:12] # shows what I can pull

        try:
            live_entries = [{
                             'html': live_leak.links,
                             'href': live_leak.links[0]['href'],
                             'src': live_leak.media_thumbnail[0]['url'],
                             'text': live_leak.title,
                             'comments': live_leak.description,
                             'url': live_leak.links[0]['href'],
                             'embed': live_leak.links[1]['href'],
                             'text': live_leak.title,
                             'comments': live_leak.description,
                             'name': name,
                             'url': live_leak.link, # this is the link to the source
                             'author': None,
                             'video': False
                             } for live_leak in live_leaks]
        except IndexError:
            print('error check logs')
            live_entries = []

        # for count, elem in enumerate(live_entries):
        #     the_html = requests.get(live_entries[count]['url']) # a specific text

        return print(live_entries[0])
</code></pre>

<p>One is looking for links under live_leak the other is just looking at live_leak itself.</p>

<p>for example:
live_leak[1] </p>

<p>should return:
[{'type': 'application/x-shockwave-flash', 'rel': 'enclosure', 'href':
 '<a href="http://www.liveleak.com/e/abf_1476121939" rel="nofollow">http://www.liveleak.com/e/abf_1476121939</a>'}]</p>

python rss feedparser