Consider a situation where you want to glean all the hyperlinks from the webpage. In this section, we will do this by programming. On the other hand, this can also be done manually by viewing the view source of the web page. However this will take some time.
The requirement is the title of the HTML page and hyperlinks.
The code is as follows:
import urllib from bs4 import BeautifulSoup url = raw_input("Enter the URL ") ht= urllib.urlopen(url) html_page = ht.read() b_object = BeautifulSoup(html_page) print b_object.title print b_object.title.text for link in b_object.find_all('a'): print(link.get('href'))
from bs4 import BeautifulSoup statement is used to import the BeautifulSoup library. The
url variable stores the...