Showing
1 changed file
with
1 additions
and
80 deletions
| ... | @@ -62,83 +62,4 @@ function crawl_Reol(url,callback){ | ... | @@ -62,83 +62,4 @@ function crawl_Reol(url,callback){ |
| 62 | }); | 62 | }); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | -exports.crawl_Reol = crawl_Reol; | ||
| 66 | - | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - | ||
| 70 | - | ||
| 71 | - | ||
| 72 | - | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - | ||
| 77 | - | ||
| 78 | - | ||
| 79 | - | ||
| 80 | - | ||
| 81 | - | ||
| 82 | - | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - | ||
| 88 | -// promise | ||
| 89 | - | ||
| 90 | -// var request = require('request'); | ||
| 91 | -// var cheerio = require('cheerio'); | ||
| 92 | -// function crawl_Reol(url){ | ||
| 93 | -// return new Promise(function(resolve, reject){ | ||
| 94 | -// request(url, function (err, res, body) { | ||
| 95 | -// const $ = cheerio.load(body); | ||
| 96 | - | ||
| 97 | -// var Reol = new Array(); | ||
| 98 | -// var album, year | ||
| 99 | -// var album_track = new Array(); | ||
| 100 | -// var json_album = new Array(), json_year = new Array(), json_track = new Array(); | ||
| 101 | -// $('body > div.content-wrapper > article > div.wiki-content.clearfix > div').each(function (index, ele) { | ||
| 102 | -// for (var i = 1; i <= $('.toc-item').length; i++) { | ||
| 103 | -// album = $(this).find('#toc > div > div:nth-child(2) > span:nth-child(' + i + ')').text() //앨범 정보 가져오기 | ||
| 104 | -// if (album != '') { | ||
| 105 | -// json_album.push(album.substr(2)); | ||
| 106 | -// } | ||
| 107 | - | ||
| 108 | -// var index = 7 + (i * 2); //트랙, 연도 가져오기 인덱스 변수 | ||
| 109 | - | ||
| 110 | -// if (index != 25) { //규칙성이 어긋나는 부분을 예외처리를 위해 if문 | ||
| 111 | -// //year 가져오기 | ||
| 112 | -// year = $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(3) > table > tbody > tr:nth-child(1) > td:nth-child(2)').text(); | ||
| 113 | -// //track 가져오기 | ||
| 114 | -// $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(3) > table > tbody').find('tr').each(function (index, ele) { | ||
| 115 | -// var track = $(this).children().eq(1).text(); | ||
| 116 | -// if (track != '1' && track != '곡명' && track[4] != '년') | ||
| 117 | -// album_track.push(track) | ||
| 118 | -// }); | ||
| 119 | -// } | ||
| 120 | -// else { | ||
| 121 | -// year = $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(4) > table > tbody > tr:nth-child(1) > td:nth-child(2)').text(); | ||
| 122 | -// $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(4) > table > tbody').find('tr').each(function (index, ele) { | ||
| 123 | -// var track = $(this).children().eq(1).text(); | ||
| 124 | -// if (track != '1' && track != '곡명' && track[4] != '년') | ||
| 125 | -// album_track.push(track) | ||
| 126 | -// }); | ||
| 127 | -// } | ||
| 128 | -// if (year != '') { | ||
| 129 | -// json_year.push(year); | ||
| 130 | -// json_track.push(album_track); | ||
| 131 | -// } | ||
| 132 | -// album_track = []; | ||
| 133 | -// } | ||
| 134 | -// }); | ||
| 135 | -// Reol.push({ json_album, json_year, json_track }); | ||
| 136 | -// if (Reol) { | ||
| 137 | -// resolve(Reol); | ||
| 138 | -// } | ||
| 139 | -// reject(new Error("Request is failed")); | ||
| 140 | -// }); | ||
| 141 | -// }); | ||
| 142 | -// } | ||
| 143 | - | ||
| 144 | -// exports.crawl_Reol = crawl_Reol; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 65 | +exports.crawl_Reol = crawl_Reol; | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment