User Tools

Site Tools


c:nmp:using_open_api_example

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
c:nmp:using_open_api_example [2020/06/04 03:22] – old revision restored (2017/05/22 08:24) hkimscilc:nmp:using_open_api_example [2020/06/09 13:43] (current) – removed hkimscil
Line 1: Line 1:
-====== 오픈 API ====== 
-<WRAP box 450px>[[http://www.law.go.kr/lsInfoP.do?lsiSeq=142444&efYd=20131031#0000|공공데이터의 제공 및 이용 활성화에 관한 법률]] \\  
-혹은 공공데이터법 \\ 
-  - "공공기관"이란 국가기관, 지방자치단체 및 「국가정보화 기본법」 제3조제10호에 따른 공공기관을 말한다. 
-  - "공공데이터"란 데이터베이스, 전자화된 파일 등 공공기관이 법령 등에서 정하는 목적을 위하여 생성 또는 취득하여 관리하고 있는 광(光) 또는 전자적 방식으로 처리된 자료 또는 정보를 말한다. 
-  - "기계 판독이 가능한 형태"란 소프트웨어로 데이터의 개별내용 또는 내부구조를 확인하거나 수정, 변환, 추출 등 가공할 수 있는 상태를 말한다.  
-  - "제공"이란 공공기관이 이용자로 하여금 기계 판독이 가능한 형태의 공공데이터에 접근할 수 있게 하거나 이를 다양한 방식으로 전달하는 것을 말한다. 
-</WRAP> 
- 
-Key 승인: 
-  * 자동승인 혹은  
-  * 심의승인 ([[http://www.kobis.or.kr/kobisopenapi/homepg/main/main.do|영화진흥위원회 API]]) -> [[http://www.kobis.or.kr/kobisopenapi/homepg/apikey/ckUser/findApikeyList.do|Click here]], temp. 
- 
-====== Sites and Services ====== 
-Search, Portal 
-  * [[http://developer.naver.com/wiki/pages/OpenAPI|네이버 오픈API]] 
-  * [[http://developers.daum.net/|다음 오픈API]] 
-Film and movies 
- 
-Public 
-  * [[https://www.data.go.kr/|공공데이터포털]] 
-    * [[https://www.data.go.kr/subMain.jsp#/L3B1Ym4vbGFiL2V4bS9Jcm9zVXNlRXhhbUxpc3QyJEBeMDIxbTI=|활용사례]] 
-      * [[https://www.data.go.kr/subMain.jsp#/L3B1Ym4vbGFiL2V4bS9Jcm9zVXNlRXhhbS9vcGVuRGV0YWlsUGFnZSRAXjA0Mm00MiRAXnByY3VzZUNhc2VTbj0xMDAzMzA0|레시피디아]] 
-  * [[http://kosis.kr/openapi/index/index.jsp|KOSIS 국가통계포털]] 
-  * [[http://openapi.its.go.kr/|교통정보 공개서비스]] 
-  * [[http://data.seoul.go.kr/index.jsp|서울 열린데이터]] 
-    * [[http://data.seoul.go.kr/openinf/board/gallery.jsp|사례]] 
-    * [[http://data.seoul.go.kr/openinf/develop/developer.jsp?id=3&tMenu=23&longLogin=N|key 신청]] 
- 
-Abroad 
-  * Amazon:  
-    * [[https://developer.amazon.com/public/apis|Amazon APIs]] 
-    * [[https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html|Product Advertising API]] 
- 
----- 
-{{all_comb.xlsx}} 
-<code>library(bitops) 
-library(RCurl) 
-library(rjson) 
-library(twitteR) 
-library(digest) 
-library(ROAuth) 
-library(KoNLP) 
-library(rJava) 
-library(tm) 
-library(wordcloud) 
-library(XLConnect) 
- 
-setwd ("D:/Users/Hyo/Clouds/CS-DS/CS/MovieStudy") 
- 
-rm(list=ls()) 
-ani<- file.path("all_comb.xlsx") 
- 
-anisheet <- readWorksheetFromFile(ani, sheet="imdb") 
-ani.text <- Corpus(VectorSource(anisheet$plotStory)) 
-result.text <- ani.text 
- 
- 
-myCorpus <- Corpus(VectorSource(result.text)) 
-myCorpus <- tm_map(myCorpus, removePunctuation) 
-myCorpus <- tm_map(myCorpus, removeNumbers) 
-myCorpus <- tm_map(myCorpus, tolower) 
-myStopwords <- c(stopwords('english'), "rt") 
-myCorpus <-tm_map(myCorpus, removeWords, myStopwords) 
- 
-inspect(myCorpus[1:5]) 
- 
-myTdm <- TermDocumentMatrix(myCorpus, control=list(wordLengths=c(2,Inf))) 
-mat <- as.data.frame(as.matrix(myTdm)) 
-write.table(mat, file="myTdm-ani.txt", col.names=FALSE, row.names=TRUE,sep="\t") 
- 
-pal <- brewer.pal(12,"Paired") 
-  
-# 폰트 세팅. 띄어쓰기나 대소문자에 민감하다는 점에 주의 
-# 맑은고딕 : windowsFonts(malgun=windowsFont("맑은 고딕")) 
-# 나눔고딕 : windowsFonts(malgun=windowsFont("나눔고딕")) 
-windowsFonts(malgun=windowsFont("서울남산체 B")) 
-  
-m <- as.matrix(myTdm) 
-# calculate the frequency of words 
-v <- sort(rowSums(m), decreasing=TRUE) 
-myNames <- names(v) 
-k <- which(names(v)=="apple") 
-myNames[k] <- "apple" 
-d <- data.frame(word=myNames, freq=v) 
-#wordcloud(d$word, d$freq, scale=c(4,0.5), min.freq=3, random.order=F, rot.per=.1, family="malgun") 
-wordcloud(d$word, d$freq, scale=c(4,0.7), min.freq=2, random.order=F, rot.per=.1, colors=pal, family="malgun") 
-</code> 
- 
-{{ani_plot.png}} 
- 
-{{myTdm-ani.txt}} 
- 
-<code><!DOCTYPE html> 
-<html><head> 
-<meta charset="UTF-8"> 
-</head> 
-<body> 
- 
-<?php 
- 
-$txt=''; 
-$myfile = fopen("daum.out.txt", "w"); 
-$lines = file('movie.dat'); 
-$key = "2de2b474cefdc3cf90ccba1e939e0174a3b3be3e"; 
- 
- 
-for ($i=0;$i<sizeof($lines);$i++) { 
- $q = $lines[$i]; 
- $url = "http://apis.daum.net/contents/movie?apikey=".$key."&output=xml&q=".urlencode($q); 
- 
- echo "$url"; 
- echo "<br />"; 
- $xml = simplexml_load_file($url); 
- echo "hello"; 
- 
- echo "<pre>"; 
- echo $xml->asXML(); 
- echo "</pre>"; 
- 
- 
- foreach ($xml->item as $oitemVal) { 
- $text = " \"".$oitemVal->title->content."\"\t"; 
- $text .= " \"".$oitemVal->eng_title->content."\"\t"; 
- $text .= $oitemVal->year->content."\t"; 
- $text .= " \"".$oitemVal->director->content."\"\t"; 
- foreach ($oitemVal->actor->content as $oContentVal) { 
- $text .= " \"$oContentVal\""; 
- } $oContentVal=""; 
- $text .= "\t"; 
- $text .= $oitemVal->more_actor->link."\t"; 
- $text .= $oitemVal->nation->content."\t"; 
- foreach ($oitemVal->genre->content as $oContentVal) { 
- $text .= " \"$oContentVal\""; 
- } $oContentVal=""; 
- $text .= "\t"; 
- $text .= $oitemVal->open_info[0]->content."\t"; 
- 
- $text .= "\n"; 
- echo "$text"; 
- fwrite($myfile, $text); 
- } 
- 
- $text=''; 
- 
-} 
- 
-fclose($myfile); 
- 
-?> 
-</body></html> 
-</code> 
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki