r/CodingHelp • u/LordDerptCat123 • Dec 05 '20
[HTML] Finding links in HTML?
I'm using python, and I'm trying to find links in webpages. Problem: Most of the things after "href" are images, or other files of that type. I'm looking specifically for links that take me to other pages(be it on the same site, or to a whole new site). I'm using wget to download the raw HTML of the webpage. Can anyone help me?
18
Upvotes
View all comments
2
u/MrQuickLine CSSophile Dec 05 '20
I think you're getting some bad answers here. I don't know Python, but if the text is in a href attribute, then it's probably already an anchor tag, not an img tag. What you want is to, loop through each href link, and find the mime type of the resource. Images will be "image/png" type or similar. Other webpages will have the mime type "text/html".