Last active
September 30, 2019 09:05
-
-
Save lakshay-arora/7ea17e4fb561bda32ee28d212c9eadb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Web Scraping - Beautiful Soup | |
""" | |
# importing required libraries | |
import requests | |
from bs4 import BeautifulSoup | |
import pandas as pd | |
# target URL to scrap | |
url = "https://www.goibibo.com/hotels/hotels-in-shimla-ct/" | |
# headers | |
headers = { | |
'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" | |
} | |
# send request to download the data | |
response = requests.request("GET", url, headers=headers) | |
# parse the downloaded data | |
data = BeautifulSoup(response.text, 'html.parser') | |
print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment