I am crawling a game website and I want to get the div object that contains a certain text. In this case I want to get the div class "GameItemWrap" that contains a href with the text "SANDBOX Ghost". There are many GameItemWrap classes in the whole code and I don't want to get the "SummonerName"class div because there are some other classes inside "GameItemWrap" that I need.
This is what I have tried :
duo_name='SANDBOX Ghost'
gamelist=soup.find('div',"GameItemList")# "GameItemList" is a div that contains "GameItemWrap"
games=gamelist.find_all('GameItemWrap',{('a'):duo_name })
This is what the javascript i am crawling looks like :
<div class="GameItemWrap>
#some other div classes that i will need in the future
<div class="SummonerName">
<a href="//www.op.gg/summoner/userName=SANDBOX+Ghost" class="Link" target="_blank">SANDBOX Ghost</a>
</div>
</div>
I am expecting 4 GameItemWraps that include the text "SANDBOX Ghost" but when I print
print(len(games))
the output is 0. This does not work. Also I do not want to check every single GameItemWraps class to check whether they contain "SANDBOX Ghost" or not Is this possible?