Web Crawling with BeautifulSoup

1
2
import requests
from bs4 import BeautifulSoup
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This example of a web crawler uses the BeautifulSoup library (you need to manually install it) http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-beautiful-soup. In this particular case, the crawler allows us to print the links' href value only if they contain a defined class. Read the documentation on here for more use cases: http://www.crummy.com/software/BeautifulSoup/bs4/doc/

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.