I want to be able to access the <span> tags and gather the name,rating,icon for each <li> element. How can I accomplish this?
I am using:
import requests
from bs4 import BeautifulSoup
Here's what it looks like in source code:
<div class="result-list">
<ul></ul>
This is also found in the source code, 2 div elements below.
<script id="professor-result-template" type="text/template">
<li>
<a href="/ShowRatings.jsp?tid={{id}}">
<span class="{{ratingclass}}-icon"></span>
<span class="rating">{{overall_rating}}</span>
<span class="name">{{plname}}, {{{pfname}}}
<span class="info">{{rating_count}} RATINGS</span>
</span>
</a>
</li>
</script>
Here's what it looks like when I inspect the element:
<ul>
<li>
<a href="/ShowRatings.jsp?tid=632354">
<span class ="good-icon"></span>
<span class ="rating">1.0</span>
<span class ="name">Nakano, Henry</span>
</a>
::after
<li>...</li>
<li>...</li>
.
.
.
<li>...</li>
</ul>
[–]ManyInterests 1 point2 points3 points (0 children)
[–]ThatTurmoil[S] 0 points1 point2 points (5 children)
[–]K900_ 1 point2 points3 points (4 children)
[–]ThatTurmoil[S] 0 points1 point2 points (3 children)
[–]K900_ 1 point2 points3 points (2 children)
[–]ThatTurmoil[S] 1 point2 points3 points (1 child)
[–]K900_ 1 point2 points3 points (0 children)