Skip to content

Commit

Permalink
修改热重载为nodemon,目前支持爬取指定url中静态页面的img
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Jul 10, 2018
1 parent d97300f commit f44b267
Show file tree
Hide file tree
Showing 6 changed files with 2,605 additions and 86 deletions.
8 changes: 5 additions & 3 deletions actions/images/getImgsAction.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
let http = require('http');
let https = require('https');
let cheerio = require('cheerio');


let imgsAction = {
getHtml(url, cb) {
https.get(url, function(res) {
let myProto = this._checkHttp(url);
console.log(myProto);
myProto.get(url, function(res) {
let html = '';
let titles = [];
res.setEncoding('utf-8');
Expand All @@ -14,7 +17,6 @@ let imgsAction = {
});

res.on('end', function() {
console.log(html);
cb(cheerio.load(html));
});
});
Expand All @@ -23,7 +25,7 @@ let imgsAction = {
getImgs(html) {
let $ = html;
let imgTags = $('img');
console.log(imgTags);
return imgTags;
},

_checkHttp(url) {
Expand Down
Loading

0 comments on commit f44b267

Please sign in to comment.