-
Notifications
You must be signed in to change notification settings - Fork 0
/
kakao-cornerBot
73 lines (62 loc) · 2.22 KB
/
kakao-cornerBot
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
'''
'''
import requests
from bs4 import BeautifulSoup
normalurl = "https://newgh.gnu.ac.kr/cs/na/ntt/selectNttList.do?mi=6694&bbsId=2351"
swurl = "https://newgh.gnu.ac.kr/cs/na/ntt/selectNttList.do?mi=6695&bbsId=2352"
normalhref = "https://newgh.gnu.ac.kr/cs/na/ntt/selectNttInfo.do?mi=6694&bbsId=2351&nttSn="
swhref = "https://newgh.gnu.ac.kr/cs/na/ntt/selectNttInfo.do?mi=6695&bbsId=2352&nttSn="
normalstartingPoint = ""
swstartingPoint = ""
normaltemp = 0
swtemp = 0
def crolling_notice():
normal = requests.get(normalurl)
normalcroll = BeautifulSoup(normal.content, "lxml")
normalnotice = normalcroll.select("a.nttInfoBtn")
for d in normalnotice:
normalNoticetitle = d.text
normalNoticehref = normalhref+d.get("data-id")
print(normalNoticehref)
print(normalNoticetitle)
def crolling_swnotice():
sw = requests.get(swurl)
swcroll = BeautifulSoup(sw.content, "lxml")
swnotice = swcroll.select("a.nttInfoBtn")
for c in swnotice:
swNoticetitle = c.text
swNoticehref = swhref + c.get("data-id")
print(swNoticetitle)
print(swNoticehref)
def counting_normalnotice():
normal = requests.get(normalurl)
normalcroll = BeautifulSoup(normal.content, "lxml")
normalNoticeNumber = normalcroll.select("td.BD_tm_none")
for z in normalNoticeNumber:
normalpoint = z.text
if ("공지" != normalpoint):
if(int(normaltemp) < int(normalpoint)):
normaltemp = normalpoint
normalpoint = normaltemp
return normalpoint
def counting_swnotice():
sw = requests.get(swurl)
swcroll = BeautifulSoup(sw.content, "lxml")
swNoticeNumber = swcroll.select("td.BD_tm_none")
for swnumber in swNoticeNumber:
swpoint = swnumber.text
if("공지" != swpoint):
if(int(swtemp) < int(swpoint)):
swtemp = swpoint
swpoint = swtemp
return swpoint
def onstart():
swstartingPoint=counting_swnotice()
normalstartingPoint=counting_normalnotice()
if __name__ == "__main__":
onstart()
while(1):
if(swstartingPoint != counting_swnotice()):
crolling_swnotice()
if(normalstartingPoint != counting_normalnotice()):
crolling_notice()