Skip to content

Commit

Permalink
Update: 네이버 실시간 검색어 다시 추가
Browse files Browse the repository at this point in the history
- 다른 웹페이지에서 긁은 다음 임의로 url 을 만듦
  • Loading branch information
Onedelay committed Jan 19, 2020
1 parent 72cc8d7 commit 9ccde12
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/kotlin/com/onedelay/crawler/CrawlingController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ class CrawlingController {
return list
}

@GetMapping("/naver_issue")
@ResponseBody
fun getNaverHotIssue(): List<HotIssue> {
val list = ArrayList<HotIssue>()

val doc = Jsoup.connect("https://datalab.naver.com/keyword/realtimeList.naver?where=main/").get()
val elements = doc.select("div.ranking_box")[0].selectFirst("ul.ranking_list").children()

for ((i, element) in elements.withIndex()) {
val name = element.selectFirst("span.item_title").text()
val url = "https://search.naver.com/search.naver?where=nexearch&query=${name}"

list.add(HotIssue(i + 1, name, url))
}

return list
}

@GetMapping("/android_weekly")
@ResponseBody
fun getAndroidWeekly(@RequestParam("count", required = false) count: Int?): List<WeeklyItem> {
Expand Down

0 comments on commit 9ccde12

Please sign in to comment.