Coder Social home page Coder Social logo

node-crawler's Introduction

1. express 활용 크롤링

NodeMVC 패턴 NodeMVC 2 패턴

1. express 설치

npm install --save express

or 

yarn add express

// express-generator는 express의 기본 틀을 가춘 프레임워크를 구조를 제공한다.
npm install express-generator -g

express preflem project_name
let exrpess = require('express');
let router = express.Router();

2. cheerio 설치

npm install --save cheerio

or 

yarn add cheerio
const cheerio = require('cheerio');

3. axios 설치

npm install --save axios

or 

yarn add axios
const axios = require('axios');

4. phantomjs, casperjs 설치

npm install --save phantomjs
npm install --save casperjs 

5. File System 이용

npm install --save fs
const fs = require('fs');
fs.writeFileSync("target.txt", '\ufeff' + text, {encoding: 'utf8'});

6. puppeteer js

npm install --save puppeteer
const puppeteer = require('puppeteer');

7. naver 검색 crawler

1) naver developer -> search API -> naver blog

2) search 후 -> cron-schasller -> data 확인

phantomjs : 커맨드라인(소스코드)으로 웹브라우저를 실행 시켜서 특정 값을 뽑아내거나 비교할 때 사용한다. 웹 브라우져는 로그인이나 특정 값들을 넣을 때 마우스로 클릭 하거나 탭으로 이동하고 해당 값들을 키보드나 마우스로 넣어주어야 한다.
casperjs : 팬텀 js를 조금 더 세밀하게 컨트롤 할 수 있는 기능들을 묶어놓은 라이브러리이다.
cheerio은 데이터를 가지고오는 정도이고, phantomjs는 조금 더 정밀한 크롤링을 가능하게 한다.

2. request or express

  1. request를 통해서 크롤링을 할 수 있다.
  2. express를 이용해서 크롤링을 할 수 있다.

두개 다 서버처럼 사용할 수 있지만, express는 node의 웹 프레임워크로 웹상으로 url를 이용해서 크롤링을 지속적으로 이용할 수 있다는 장점이있다.

3. git 대용량 파일 올리기

// git large files = 큰 파일을 올리는 저장소
git lfs install

// 파일을 올릴 확장자 && git igrone와 비슷한 역할
git lfs track "*.dll"
git lfs track "*.exe"

// 만약에 잘못올린게 있다면
git repack
git gc

// 가끔 올리는 상태에서 캐쉬가 남아있는 경우가 있다.
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch file_name or directory'

node-crawler's People

Contributors

yeo11200 avatar

Watchers

James Cloos 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.