Skip to content

Commit

Permalink
d
Browse files Browse the repository at this point in the history
  • Loading branch information
waroad committed Jun 3, 2021
1 parent a96c5ab commit 0f2a7fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions 6주차.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
headers = {
'User-Agent': 'Not Crawling X'
}

response = requests.get('https://kin.naver.com/', headers=headers).text
soup = bs4.BeautifulSoup(response, 'html.parser')
trends = soup.select('#rankingChart > ul > li')

rank = lambda trend: int(trend.select_one('span.no').text)
content = lambda trend: trend.select_one('a.ranking_title').text

with open('kin_trend.csv', 'w') as file:
file.write("순위, 이름\n")
for trend in sorted(trends, key=rank):
file.write(f'{rank(trend)}위, {content(trend)}\n')
for trend in trends:
file.write(f'{int(trend.select_one("span.no").text)}위, {trend.select_one("a.ranking_title").text}\n')
6 changes: 3 additions & 3 deletions kin_trend.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
1��, 2021 ��3 6�� ���ǰ��� ���� Ȯ�� ������ ����..
2��, ŷ�� ��ǥ�ϴ� ��� �˷��ּ���
3��, ��Ͽ� �ȳ�� ������ ������?
4��, �������� ��PD����
5��, ��ģ�̶� ������µ� ��ģ������ �ʼ�
6��, ���������� ���ſ� ���ؼ�
7��, ��Ʈ���� ��������
8��, Mbti �̻��� �׽�Ʈ ��ũ�Ф�
9��, �һ���� �������ڱ� �÷���
4��, �������� ��PD����
5��, ��ģ�̶� ������µ� ��ģ������ �ʼ�
6��, ���������� ���ſ� ���ؼ�
10��, ���̹� ������ �����ϴ� ���� �˷��ּ�

0 comments on commit 0f2a7fc

Please sign in to comment.