https://github.com/aadewunmi/following-links-in-html-using-beautifulsoup
This program will use urllib to read the HTML from the data files below, extract the href= vaues from the anchor tags, scan for a tag that is in a particular position relative to the first name in the list, follow that link and repeat the process a number of times and report the last name you find.
https://github.com/aadewunmi/following-links-in-html-using-beautifulsoup
Last synced: 7 months ago
JSON representation
This program will use urllib to read the HTML from the data files below, extract the href= vaues from the anchor tags, scan for a tag that is in a particular position relative to the first name in the list, follow that link and repeat the process a number of times and report the last name you find.
- Host: GitHub
- URL: https://github.com/aadewunmi/following-links-in-html-using-beautifulsoup
- Owner: AAdewunmi
- Created: 2019-07-29T16:05:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-30T07:11:44.000Z (about 6 years ago)
- Last Synced: 2025-01-25T06:11:36.535Z (9 months ago)
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Following-Links-in-HTML-Using-BeautifulSoup
This program will use urllib to read the HTML from the data files below,
extract the href= vaues from the anchor tags, scan for a tag that is in a
particular position relative to the first name in the list, follow that link and repeat
the process a number of times and report the last name you find.
Actual problem: Start at: http://py4e-data.dr-chuck.net/known_by_Dayna.html
Find the link at position 18 (the first name is 1). Follow that link. Repeat this process 7 times.
The answer is the last name that you retrieve.
Hint: The first character of the name of the last page that you will load is: A
Sample execution
Here is a sample execution of a solution:
$ python3 solution.py
Enter URL: http://py4e-data.dr-chuck.net/known_by_Fikret.html
Enter count: 4
Enter position: 3
Retrieving: http://py4e-data.dr-chuck.net/known_by_Fikret.html
Retrieving: http://py4e-data.dr-chuck.net/known_by_Montgomery.html
Retrieving: http://py4e-data.dr-chuck.net/known_by_Mhairade.html
Retrieving: http://py4e-data.dr-chuck.net/known_by_Butchi.html
Retrieving: http://py4e-data.dr-chuck.net/known_by_Anayah.html
The answer to the assignment for this execution is "Anayah".