<jupyter_start><jupyter_text>Import Modules<jupyter_code>from bs4 import BeautifulSoup
import requests<jupyter_output><empty_output><jupyter_text>Get Page Content from URL<jupyter_code>url = 'https://www.thehindu.com/news/national/coronavirus-live-updates-may-29-2021/article34672944.ece?homepage=true'
page = requests.get(url)
page
# display page content
page.content
# parse the data
soup = BeautifulSoup(page.content, 'html.parser')
print(soup.prettify())
# find the image src link
img_tag = soup.find('source')
img_tag
img_tag['srcset']
img_url = img_tag['srcset']<jupyter_output><empty_output><jupyter_text>Download the Image from URL<jupyter_code>image = requests.get(img_url)
# store the image in file
with open('image.jpg', 'wb') as file:
    for chunk in image.iter_content(chunk_size=1024):
        file.write(chunk)<jupyter_output><empty_output><jupyter_text>Download PPT from URL<jupyter_code>ppt = requests.get('http://www.howtowebscrape.com/examples/media/images/SampleSlides.pptx')
with open('sample.pptx', 'wb') as file:
    for chunk in ppt.iter_content(chunk_size=1024):
        file.write(chunk)<jupyter_output><empty_output><jupyter_text>Download Video from URL<jupyter_code>video = requests.get('http://www.howtowebscrape.com/examples/media/images/BigRabbit.mp4')
with open('BigRabbit.mp4', 'wb') as file:
    for chunk in video.iter_content(chunk_size=1024):
        file.write(chunk)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12952646239554316, 'fraction_numerical': 0.0201949860724234, 'mean_word_length': 6.852459016393443, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '63370', 'license': 'MIT', 'n_tokens_mistral': 547, 'n_tokens_neox': 514, 'n_words': 85, 'path': 'Scraping Multimedia Files using Beautiful Soup.ipynb', 'repo_name': 'SivaNarayana1/web-scraping', 'size': '1436'}