Jump to content
UBot Underground

Scrape only root urls on webpage?


Recommended Posts

I'm trying to build a backlinks scraper by scraping results from a backlink checking site and my issue is I only want to scrape root domains on the result page - if the backlink is a subfolder or xyz.html then I don't want to save it.

 

Example:

 

www.domain.com/stuff/blah.html <- i don't want it

www.domain2.com <- i want it

domain3.com/hello/ <- i don't want it

domain4.com <- i want it

 

So, I need some sort of code to only grab <a hrefs which simply ends with .com .net .org.

 

So, how would this be done? I'm thinking of grabbing all a hrefs on the page and then clean it up with regex or if it's possible to grab it with regex from the beginning. I also need to clean out all urls which links to the backlinking site itself.

 

I'm looking for some code for this since I'm not an expert with regex.

Link to post
Share on other sites
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...