{"size": 736, "ext": "js", "max_stars_repo_path": "express-spider/app.js", "max_stars_repo_name": "TingGe/web-spiders", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "express-spider/app.js", "max_issues_repo_name": "TingGe/web-spiders", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "express-spider/app.js", "max_forks_repo_name": "TingGe/web-spiders", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.5333333333, "max_line_length": 56, "alphanum_fraction": 0.5298913043}
const express = require('express');
const superagent = require('superagent');
const cheerio = require('cheerio');
const app = express();

app.get('/', (req, res, next) => {
  superagent.get('http://dig.chouti.com')
    .end((err, sres) => {
      if (err) {
        return next(err);
      }

      const items = [];
      const $ = cheerio.load(sres.text);
      $('#content-list .part2').each((idx, element) => {
        const $element = $(element);
        items.push({
          title: $element.attr('share-title'),
          href: $element.attr('href'),
          img: $element.attr('share-pic')
        });
      });
      res.send(items);
    });
});

app.listen(3000, () => {
  console.log('app is listening at port 3000');
});
