Aug-12-2020, 05:00 AM
hi there, I have the following scraping code which gets the information I want for the first game but when I try to loop through the page, to get the other game information on the same page, the script fails with ...
TIA
for data in datas: TypeError: 'Element' object is not iterableAny help appreciated,
TIA
from requests_html import HTML, HTMLSession session = HTMLSession() r = session.get("https://www.afl.com.au/fixture") r.html.render() data = r.html.find('section')[11] #print(data.text) #for data in datas: date = data.find('.match-list__group-date', first=True).text print(date) lteam = data.find('.match-team__name')[0].text ltscore = data.find('.match-scoreboard__score-total', first=True).text rteam = data.find('.match-team__name')[1].text rtscore = data.find('.match-scoreboard__score-total')[1].text mtime = data.find('.match-scoreboard__status-label', first=True).text print(lteam + '[' + ltscore + ']' + ' ' + 'VS' + ' ' + rteam + '[' + rtscore + ']' + ' ' + '(' + mtime + ')') print()