Reputation: 1133
I'll preface this by saying I'm relatively new to beautiful soup. I understand that the following line:
soup.find_all('div', class_ = 'favorite_links')[0]
will get me the entire contents of the first div tag where class = favorite-links. However what I actually want is text that is immediately to the right of the class name:
<div class="favorite-links" data-can-favorite="" data-id="10820653">
</div>
What I hope to get is the numbers after data-id. Is there a way to do this? I could definitely do it using string operations but I want to know whether there is a way to do this specifically using BeautifulSoup
Sorry in advance for my poor terminology. As I said before I'm relatively new to BeautifulSoup.
Thanks!
Upvotes: 0
Views: 52