Skip to content

Commit bd5b280

Browse files
authored
Merge pull request #1723 from Tanya-1109/master
Added link Scrapper
2 parents 2696ddd + 6b54005 commit bd5b280

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Readme.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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

script.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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)

0 commit comments

Comments
 (0)