Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Python Web Penetration Testing

You're reading from   Learning Python Web Penetration Testing Automate web penetration testing activities using Python

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781789533972
Length 138 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Christian Martorella Christian Martorella
Author Profile Icon Christian Martorella
Christian Martorella
Arrow right icon
View More author details
Toc

Making our crawler recursive

In this section, we'll start learning how to extract links, and then we'll use them to make the crawler recursive. Now that we have created the basic structure of a crawler, let's add some functionality:

  1. First, let's copy the prepared spiderman.py file for this exercise. Copy it from examples/spiders/spiderman-recursive.py to basic_crawler/basic_crawler/spiders/spiderman.py.
  1. Then, go back to our editor. As we would like to make the crawler recursive, for this purpose, we will once again work the spiderman.py file and start with adding another extractor. However, this time we'll add the links instead of titles, as highlighted in the following screenshot:
  1. Also, we need to make sure that the links are valid and complete, so we'll create a regular expression that will validate links highlighted in the following screenshot...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime