-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBottledWaterinBDWebScraper.py
More file actions
44 lines (34 loc) · 1.32 KB
/
BottledWaterinBDWebScraper.py
File metadata and controls
44 lines (34 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
''' import requests
from bs4 import BeautifulSoup
# URL of the website to scrape
url = "http://bbs.gov.bd/bottled-water-bangladesh"
# Send a GET request to the website and retrieve the HTML content
response = requests.get(url)
html_content = response.content
# Parse the HTML content using BeautifulSoup
soup = BeautifulSoup(html_content, "html.parser")
# Extract the relevant information from the HTML page
bottled_water_items = soup.find_all("div", class_="bottled-water-item")
for item in bottled_water_items:
name = item.find("div", class_="name").text
price = item.find("div", class_="price").text
availability = item.find("div", class_="availability").text
# print_bottled_water_info(url)
print(f"Name: {name}")
print(f"Price: {price}")
print(f"Availability: {availability}")
'''
import requests
from bs4 import BeautifulSoup
# URL of the website to scrape
url = "https://www.dwasa.org.bd"
# Send a GET request to the website and retrieve the HTML content
response = requests.get(url)
html_content = response.content
# Parse the HTML content using BeautifulSoup
soup = BeautifulSoup(html_content, "html.parser")
# Search for the specified phrase in the HTML content
if "Bangladesh" in soup.text:
print("The phrase was found on the website!")
else:
print("The phrase was not found on the website.")