Question: Get heavily nested li elements

Question

Get heavily nested li elements

Answers 0
Added at 2016-12-12 20:12
Tags
Question

I have looked around on lots of posts regarding bs4 and getting html elements, at which I have suceeded, however, when I try to get nested elements which in this case is a li element I don't have luck.

HTML

http://image.prntscr.com/image/3e3b1eb455734d98b236f89c561f6f56.png

with requests.Session() as c:
url = 'https://firefly.clevedonschool.org.uk/login/login.aspx?prelogin=http%3a%2f%2ffirefly.clevedonschool.org.uk%2f'
USERNAME = 'usr'
PASSWORD = 'pass'
c.get(url)
login_data = dict(username=USERNAME, password=PASSWORD)
c.post(url, data=login_data, headers={"Referer": "https://firefly.clevedonschool.org.uk"})
tasks = c.get("https://firefly.clevedonschool.org.uk/tasks")

print tasks.content

soup = bs(urllib2.urlopen("https://firefly.clevedonschool.org.uk/tasks").read(), "html.parser")

tasks_list = soup.findAll('li', class_="ff-task")

print tasks_list

What is returned from this is []

Example li element: hastebin.com/tosajugewe.js

Linked above is the html and you can see the li/s which I am trying to get.

Any help will be appreciated.

Answers to

Get heavily nested li elements

Source Show
◀ Wstecz