17. 01. 01

18. 1. 1

오늘 한 일

  • AWS를 이용한 웹툰 알리미 제작 시작
    • 처음에는 파이썬을 이용해서 크롤링을 할려고 인프런의 파이썬을 이용한 웹 크롤링 수업을 시청하였으나 너무 기간이 오래 걸릴 것 같아 자바로 하는 것으로 선회.
    • 프로젝트를 작은 단위로 분해
      • slack 채널에 통신하는 Api 제작
        • apache Httpclient 라이브러리를 이용해서 Slack web hook api 규격에 맞춰 통신
        • 코드
            public static void sendPost(String msg) throws ClientProtocolException, IOException {
               try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
          
                  String requestJson = "{\"text\": \"" + msg + "\"}";
                  StringEntity stringEntity = new StringEntity(requestJson, "UTF-8");
                        HttpPost httpPost = new HttpPost(POST_URL);
                        httpPost.addHeader("Content-type", "application/json");
                        httpPost.setEntity(stringEntity);
          
                        System.out.println("Executing request " + httpPost.getRequestLine());
          
                        // Create a custom response handler
                        ResponseHandler<String> responseHandler = response -> {
                            int status = response.getStatusLine().getStatusCode();
                            if (status >= 200 && status < 300) {
                                HttpEntity responseEntity = response.getEntity();
                                return responseEntity != null ? EntityUtils.toString(responseEntity) : null;
                            } else {
                                throw new ClientProtocolException("Unexpected response status: " + status);
                            }
                        };
                        String responseBody = httpclient.execute(httpPost, responseHandler);
                        System.out.println("----------------------------------------");
                        System.out.println(responseBody);
                    }
            }
          
      • 웹툰사이트에서 데이터를 크롤링
        • Jsoup 라이브러리를 이용해서 데이터 크롤링(작업중)

앞으로 할 일

  • 2018년 1년 계획 잡기
  • Spring boot 게시판 마무리 (진행 중)
  • 노마드코더 - 인스타그램 강의 시청
  • 회사 정리
  • 객체지향 + TDD 연습을 위한 토이프로젝트 구현 예정(로또)

Comments