forked from vcandelario/tempName
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscraper.py
46 lines (34 loc) · 1.24 KB
/
scraper.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
41
42
43
44
45
46
import time
import requests
from bs4 import BeautifulSoup
class scrap:
def __init__(self, i, nam = "", sco = 0, dif = 0):
id = i
url = 'https://www.ratemyprofessors.com/ShowRatings.jsp?tid=' + str(i)
#nam = ""
#sco = 0
#dif = 0
page = requests.get(url)
soup = BeautifulSoup(page.text, "html.parser")
profscore = soup.findAll("div", {"class": "RatingValue__Numerator-qw8sqy-2 liyUjw" })
profname = soup.findAll("div", {"class": "NameTitle__Name-dowf0z-0 cfjPUG"})
profdifficult = soup.findAll("div", {"class": "FeedbackItem__FeedbackNumber-uof32n-1 kkESWs"})
for mytag in profname:
print(mytag.get_text())
self.nam = mytag.get_text()
#time.sleep(5)
for mytag in profscore:
#print(mytag.get_text())
self.sco = mytag.get_text()
#time.sleep(5)
for mytag in profdifficult:
#print(mytag.get_text())
self.dif = mytag.get_text()
for mytag in
def getNam(self):
return self.nam
def getSco(self):
return self.sco
def getDif(self):
return self.dif
#scrap(1433095) #test code