Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to scrape HTML hyperlink text, rather than just the URL?

Im trying to scrape some text from :https://twitchtracker.com/criticalrole/games, in order to show a streamers most streamed game for a twitch pay data analysis project.

I am trying to scrape "Dungeons & Dragons" from the first row in the table, but so far Ive only scraped the href.

My Code: table = soup2.find(id='games').select('a', limit=1) print(table)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Output [<a href="/criticalrole/games/509577"> Dungeons &amp; Dragons </a>]

>Solution :

Use get_text():

print(table[0].get_text())
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading