Skip to content

Commit fe09e23

Browse files
committed
added readme
1 parent 1027f09 commit fe09e23

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Image-Scraper/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Image Scraper
2+
3+
The aim of the provided script is to scrape all HTML <img> tags from a given URL.
4+
5+
Here is a breakdown of the code:
6+
7+
It imports the necessary modules: BeautifulSoup from the bs4 (Beautiful Soup) library for parsing HTML, and requests for making HTTP requests.
8+
The code checks the length of the command-line arguments. If the length is not equal to 2 (indicating that a URL was not provided), it exits with an error message.
9+
It uses the requests.get() function to make an HTTP GET request to the provided URL. The User-Agent header is set to mimic a web browser to avoid any potential blocking or filtering.
10+
The response from the request is then passed to BeautifulSoup to parse the HTML content of the page.
11+
The find_all() method is used on the parsed HTML data to find all <img> tags with a valid src attribute. The src=True parameter filters out <img> tags without the src attribute.
12+
A loop iterates over the list of found images, and each image is printed.
13+
14+
In summary, the script allows you to scrape and print all HTML <img> tags (along with their attributes) from a given URL.
15+
16+
17+
### Installation Requirements -
18+
1. pip install beautifulsoup4
19+
2. pip install requests
20+

0 commit comments

Comments
 (0)