tobby48 4 years ago
parent
commit
018a04d9fc
1 changed files with 11 additions and 0 deletions
  1. 11
    0
      src/main/python/kr/co/swh/lecture/opensource/html/gameRanking.py

+ 11
- 0
src/main/python/kr/co/swh/lecture/opensource/html/gameRanking.py View File

@@ -0,0 +1,11 @@
1
+import requests
2
+from bs4 import BeautifulSoup  # BeautifulSoup import
3
+
4
+response = requests.get('http://gevolution.co.kr/rank/aos')
5
+html = response.text
6
+soup = BeautifulSoup(html, 'html.parser')  # html.parser를 사용해서 soup에 넣겠다
7
+ranking = 1
8
+for tag in soup.select('div[class=item-info] div[class=grp] span[class=rank1] a'):
9
+    url = tag.get('href')
10
+    print("\n" + str(ranking) + '위 : ' + tag.text.strip())
11
+    ranking = ranking + 1