From 1bbccdb8e3828cdd00dfbfab00a44ea771ce18bf Mon Sep 17 00:00:00 2001 From: Subham Kumar Mohapatra <61555733+techysubham@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:32:46 +0530 Subject: [PATCH] Create Instagram Scrapping.py --- src/Instagram Scrapping.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/Instagram Scrapping.py diff --git a/src/Instagram Scrapping.py b/src/Instagram Scrapping.py new file mode 100644 index 0000000..1234ee3 --- /dev/null +++ b/src/Instagram Scrapping.py @@ -0,0 +1,22 @@ +# INSTAGRAM SCRAPPING +import requests +from bs4 import BeautifulSoup + +URL = "http://www.instagram.com/{}/" + +def scrape(username): + full_url = URL.format(username) + r = requests.get(full_url) + s = BeautifulSoup(r.text,"lxml") + + tag = s.find("meta",attrs = {"name":"description"}) + text = tag.attrs['content'] + main_text = text.split("-")[0] + + + return main_text + + +USERNAME = input("Enter the Username") +data = scrape(USERNAME) +print(data)