Giter VIP home page Giter VIP logo

web-reptiles's Introduction

可调节的 WEB 爬虫 (egg.js)

image image

QuickStart

see egg docs for more detail.

Environment Dependencies

  • mysql

Development

$ npm i
$ npm run dev
$ open http://localhost:7001/

Don't tsc compile at development mode, if you had run tsc then you need to npm run clean before npm run dev.

Deploy

// app/config/config.default.ts

// 数据库配置
  config.sequelize = {
    dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
    database: 'imove',
    host: 'localhost',
    port: '3306',
    username: 'root',
    password: '123456',
  };

$ npm run tsc
$ npm start

Npm Scripts

  • Use npm run lint to check code style
  • Use npm test to run unit test
  • se npm run clean to clean compiled js at development mode once

Requirement

  • Node.js 8.x
  • Typescript 2.8+

Demo

// /dev/task/create

任务名称:阳光电影详情爬取规则

执行代码:
const text = args.$('.co_content8').text();

console.log(text);

var title = text.substring(text.indexOf('◎译  名') + 6, text.indexOf('◎片  名'));

console.log(title);

const downlink = text.match(/ftp.*/)[0];

console.log(downlink);

const post = args.$('#Zoom img')[0].attribs.src;

console.log(post);

const Movie = args.ctx.app.model.Movie;

(async () => {
    const movie = await Movie.create({
        name: title,
        grade: 7,
        downlink: JSON.stringify([downlink]),
        post,
        description: 'desc',
        time: '120'
    });
    console.log(movie);
})();

// /dev/url/new

URL 地址: http://www.ygdy8.net/html/gndy/dyzz/20091008/22098.html

选择执行 Task 规则: 阳光电影详情爬取规则

web-reptiles's People

Contributors

akira0705 avatar

Stargazers

总督sir avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.