info@worthwebscraping.com

Medicine Data Scraping from 1mg using Python

Medicine Data Scraping from 1mg using Python

Download Python Script

Send download link to:

With a pharmacy website, you can easily get your medicines delivered to your home. Just go to the website to easily order medicines anytime and from anywhere. You can use the website to order your medicines, consult a doctor online, save medical records, track the given order, check rates, rate the items purchased, and more. So this tutorial cover Healthcare data scraping using python.

There are many big players in the global online pharmacy market like 1MG, AskApollo, Medlife, MedPlus, Netmeds, NowRx, OptumRx, PharmEasy, PillPack, Practo, RiteAid, and Saydl.

1mg.com is India’s popular online pharmacy website with a large range of prescription and over the counter medicines. It enables users to find information about medicines prescribed by doctors and also buy them. One can find drugs by ailments, class, companies, and brands.

In this tutorial we will learn how we can scrape data from 1mg like product name, price etc. We will go to this link https://www.1mg.com/categories/exclusive/immunity-boosters/vitamin-c-734 and scrape data related to Vitamin C tablet’s available on the website.

See the complete code below or watch the video for detailed explanation:

Import Libraries:

import requests
from bs4 import BeautifulSoup as soup

Define header:

header = {'Origin': 'https://www.1mg.com',
'Referer': 'https://www.1mg.com/categories/exclusive/immunity-boosters/vitamin-c-734',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36'
}

Send a get request:

url = 'https://www.1mg.com/categories/exclusive/immunity-boosters/vitamin-c-734'
html = requests.get(url=url,headers=header)

Get product name:

product_name = []
for name in bsobj.findAll('div',{'itemprop':'name'}):
product_name.append(name.text.strip())
product_name

Output:

Hope you learn about Healthcare data scraping from website like 1mg. Download script and try it. If you are in need of bulk healthcare or medicine data then use our scraping services. Once download our sample data of scraping Medicine information.