Skip to content

Commit 6d246fb

Browse files
committed
ADD webscraper.py
1 parent 9629aef commit 6d246fb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

webscraper.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
# Make a request
4+
page = requests.get("Paste a Domain here")
5+
soup = BeautifulSoup(page.content, 'html.parser')
6+
7+
# Create all_h1_tags as empty list
8+
all_h1_tags = []
9+
10+
# Set all_h1_tags to all h1 tags of the soup
11+
for element in soup.select('h1'):
12+
all_h1_tags.append(element.text)
13+
14+
print(all_h1_tags)
15+
16+
# give you all h1 tags

0 commit comments

Comments
 (0)