-
Notifications
You must be signed in to change notification settings - Fork 0
/
Birdies Web Scrapping.py
40 lines (30 loc) · 1018 Bytes
/
Birdies Web Scrapping.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#Import Basic Librarries
import os
#!nvidia-smi
HOME = os.getcwd()
print("HOME:", HOME)
import numpy as np
import pandas as pd
import requests
from tqdm.notebook import tqdm
import copy
from bs4 import BeautifulSoup
import base64
import json
#Sample Code for 'https://www.livgolf.com/stats/birdies?season=2024&tournamentId=27&tab=players' Data Collections
url = "https://www.livgolf.com/stats/birdies?season=2024&tournamentId=27&tab=players"
r = requests.get(url) # r variable has all the HTML code
htmlContent = r.content # r returns response so if we want the code we write r.content
#print(htmlContent) # printing the code
htmlText = r.text
#print(htmlText)
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
#print(soup.prettify()) # to print html in tree structure
soup = BeautifulSoup(htmlContent, 'html.parser')
title = soup.title
#print(title)
#This line will get you all p tags of the page:
paras = soup.find_all('p')
for i in paras:
print(i)