File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ # LINK SCRAPPER
2
+
3
+
4
+ - It is used to scrape links from any website and display it.
5
+
6
+
7
+ ## Setup instructions
8
+
9
+ Any PC with python 3 installed can run this code.
10
+
11
+
12
+ ## Output
13
+ image.png
14
+
15
+ ## Author(s)
16
+
17
+ Tanya Mohanka
Original file line number Diff line number Diff line change
1
+ import requests
2
+ from bs4 import BeautifulSoup
3
+
4
+ def scrape_links (url ):
5
+ response = requests .get (url )
6
+ soup = BeautifulSoup (response .text , 'html.parser' )
7
+ links = soup .find_all ('a' )
8
+ for link in links :
9
+ href = link .get ('href' )
10
+ if href and href .startswith ('http' ): # Filter out non-HTTP links
11
+ print (href )
12
+
13
+ # Example usage:
14
+ url = 'https://www.linkedin.com/feed/' # Replace with the URL of the website you want to scrape
15
+ scrape_links (url )
You can’t perform that action at this time.
0 commit comments