Skip to content

Instantly share code, notes, and snippets.

@kkweon
Created March 13, 2017 23:47
Show Gist options
  • Save kkweon/d45381b98cdbc4f95874e699498f35c7 to your computer and use it in GitHub Desktop.
Save kkweon/d45381b98cdbc4f95874e699498f35c7 to your computer and use it in GitHub Desktop.
Naver News Requests Json Example
import json
import requests
url = "http://news.naver.com/main/mainNews.nhn"
payloads = {'componentId': 949984, 'page': 1, 'date': '2016-03-13 00:00:00'}
req = requests.get(url, params=payloads)
js = json.loads(req.text)
print(js.keys()) # dict_keys(['itemList', 'dateList', 'pagerInfo', 'currentDate'])
for item in js['itemList']:
print(item['title']) # check possible keywords
"""
Possible Keywords
=================
id: 29693347,
componentId: 949984,
title: "외신들 "이세돌, 마지막 남은 자존심 지켰다"",
summary: "【서울=뉴시스】김혜경 기자 = 13일 이세돌 9단이 구글의 인공지능 알파고와의 대국..."
articleId: "0007094752",
articleType: "1",
articleDate: "2016-03-13 23:18:54.0",
originFeedingDate: "2016-03-13 23:20:02.0",
officeId: "003",
officeName: "뉴시스",
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment