LinkedInpost / scrap_post.py
jobanpreet123's picture
scrapping code changed
11dec1a
raw
history blame
388 Bytes
import requests
import json
from bs4 import BeautifulSoup
def scrappost(url):
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
span_tags = soup.find_all('script',type="application/ld+json")
content_list = [tag.get_text() for tag in span_tags]
for content in content_list:
data=json.loads(content)['articleBody']
return data