BeautifulSoup errors
<p>I am getting errors when running it.</p>

<pre><code>import requests
from bs4 import BeautifulSoup

url = "http://sport.citifmonline.com/"
url_page_2 = "url" + "2016/10/15/chelsea-3-0-leicester-city-dominant-blues-comfortable-against-champions-photos/"
r = requests.get(url)

soup = BeautifulSoup(r.content, "html5lib")

links = soup.find_all("a")

for link in links:
    print "&lt;a href='%s'&gt;%s&lt;/a&gt;" %(link.get("href"), link.text)

g_data = soup.find_all("div", {"class": "wrapper"})

for item in g_data:
    articles = item.content[0].find_all("a", {"class": "cat-box-content"})[0].text
    try:
        print item.contents[1].find_all("h3", {"class": "post-box-title"})[0].text
    except:
        pass
</code></pre>

<p>If you haven't installed <code>html5lib</code> (e.g. with <code>pip install html5lib</code>), you won't be able to use this parser without getting an error. You could either install it or go e.g. for <code>"html.parser"</code> instead which is also mentioned in the <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/" rel="nofollow">documentation of BeautifulSoup</a> - just to avoid any errors:</p>

<pre><code>soup = BeautifulSoup(r.content, "html.parser")
</code></pre>

<p>Furthermore, the first line of your inner/second <code>for</code> loop throws a <code>TypeError</code> because you are trying to index something that is not subscriptable (because it's not a list or something like that, see e.g. <a href="http://stackoverflow.com/questions/216972/in-python-what-does-it-mean-if-an-object-is-subscriptable-or-not">here</a> for more details). Actually, it's not even existing - the property <code>content</code> you're trying to access is <code>None</code> (which is of course not subscriptable). You should rather do direct calls of <code>find_all</code> on each of the elements:</p>

<pre><code>item.find_all(...)
</code></pre>

python beautifulsoup html-parsing