File size: 388 Bytes
11dec1a
 
 
46290fc
 
 
11dec1a
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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