Showing
3 changed files
with
1 additions
and
60 deletions
... | @@ -43,13 +43,10 @@ function Chatbot() { | ... | @@ -43,13 +43,10 @@ function Chatbot() { |
43 | const response = await Axios.post('/api/crawling/textQuery', textQueryVariables) | 43 | const response = await Axios.post('/api/crawling/textQuery', textQueryVariables) |
44 | console.log("res",response) | 44 | console.log("res",response) |
45 | 45 | ||
46 | - for(let content of response.data){ | 46 | + for (let content of response.data) { |
47 | console.log(content) | 47 | console.log(content) |
48 | } | 48 | } |
49 | 49 | ||
50 | - | ||
51 | - | ||
52 | - | ||
53 | } else { | 50 | } else { |
54 | //I will send request to the textQuery ROUTE | 51 | //I will send request to the textQuery ROUTE |
55 | const response = await Axios.post('/api/dialogflow/textQuery', textQueryVariables) | 52 | const response = await Axios.post('/api/dialogflow/textQuery', textQueryVariables) |
... | @@ -161,10 +158,6 @@ function Chatbot() { | ... | @@ -161,10 +158,6 @@ function Chatbot() { |
161 | } | 158 | } |
162 | 159 | ||
163 | 160 | ||
164 | - | ||
165 | - | ||
166 | - | ||
167 | - | ||
168 | // template for card message | 161 | // template for card message |
169 | 162 | ||
170 | 163 | ... | ... |
server/cheerio/video.js
deleted
100644 → 0
1 | -const axios = require('axios'); | ||
2 | -const cheerio = require('cheerio'); | ||
3 | - | ||
4 | -/* | ||
5 | -이런 식으로 전달해야함. card 컴포넌트에 | ||
6 | - { | ||
7 | - "description": "Youtube", | ||
8 | - "image": "", | ||
9 | - "link": "https://www.youtube.com", | ||
10 | - "stack": "minjeong" | ||
11 | - } | ||
12 | -*/ | ||
13 | - | ||
14 | -module.exports = function video(name){ | ||
15 | - console.log("My favorite singer",name) | ||
16 | - var url = 'https://tv.naver.com/search/clip?query=' //naverTV의 링크 | ||
17 | - var sort = '&sort=date' | ||
18 | - | ||
19 | - url = url + name + sort | ||
20 | - url = encodeURI(url) | ||
21 | - console.log("url is ",url) | ||
22 | - const getHtml = async() => { | ||
23 | - try{ | ||
24 | - return await axios.get(url); //axios.get 함수를 이용해서 비동기로 네이버티비의 해당 가수의 최신 영상 html 파일을 가져온다. | ||
25 | - } catch(error){ | ||
26 | - console.log("error! check your code"); | ||
27 | - } | ||
28 | - }; | ||
29 | - | ||
30 | - getHtml() | ||
31 | - .then(html => { | ||
32 | - let videoList = []; | ||
33 | - const $ = cheerio.load(html.data); | ||
34 | - const $bodyList = $("div.src_wrap div.thl ").children("div.thl_a"); | ||
35 | - | ||
36 | - $bodyList.each(function(i, elem){ | ||
37 | - videoList[i] = { | ||
38 | - description : "naverTV", | ||
39 | - image : $(this).find('a.cds_thm').children('img').attr('src'), | ||
40 | - title : $(this).find('a.cds_thm').attr('title'), | ||
41 | - link : "https://tv.naver.com/" + $(this).find('a.cds_thm').attr('href') | ||
42 | - } | ||
43 | - }) | ||
44 | - | ||
45 | - var data = videoList.filter(n => n.title); | ||
46 | - data = JSON.stringify(data.slice(0,3)) | ||
47 | - | ||
48 | - return data; | ||
49 | - }) | ||
50 | - //.then(res=>console.log(res)); | ||
51 | -} |
1 | const express = require('express'); | 1 | const express = require('express'); |
2 | const router = express.Router(); | 2 | const router = express.Router(); |
3 | const uuid = require('uuid'); //uuid 제대로 이해하고 다시 작성하기. | 3 | const uuid = require('uuid'); //uuid 제대로 이해하고 다시 작성하기. |
4 | -//const video = require('../cheerio/video'); | ||
5 | 4 | ||
6 | const axios = require('axios'); | 5 | const axios = require('axios'); |
7 | const cheerio = require('cheerio'); | 6 | const cheerio = require('cheerio'); | ... | ... |
-
Please register or login to post a comment