I am looking at the link for the song Blank Space by Taylor Swift. I am trying to isolate just the number of views. But I can't seem to get it to use as a number.
This is what it returns:
Taylor Swift - Blank Space - YouTube
[u'721,891,621']
It isn't really a number, because I get this error if I add a 1:
print pizza[0].contents +1
TypeError: can only concatenate list (not "int") to list
Here is the code.
from bs4 import BeautifulSoup
import urllib2
url="https://www.youtube.com/watch?v=e-ORhEE9VVg"
page=urllib2.urlopen(url)
soup = BeautifulSoup(page.read())
print unicode(soup.title.string)
pizza= soup.find_all("div",{"class","watch-view-count"})
print pizza[0].contents