Spaces:
Sleeping
Sleeping
| 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 |