WORDPRESS crawler
A crawler for articles of wordpress
Install
npm install wordpress-posts-crawler --save-dev
Usage
.findAll()
/**
@param {object} opts - options
@param {string} opts.url - Url of blog (wordpress) that you want to crawl the lists.
@returns {ArticleShallow}
*/
example
let articles = await wordpress// expect arrayconsole
.find()
/**
@param {object} opts - options
@param {string} opts.url - Url of article that you want to crawl the detail.
@returns {Article}
*/
Example
let article = await wordpress// expect objectconsole
Interface
ArticleShallow
/**
@interface ArticleShallow
@prop {string} url - Url of article
@prop {string} published - Published of article (format ISO8601)
@prop {string} title - Title of article
*/
Article
/**
@interface Article
@prop {string} url - Url of article
@prop {string} published - Published of article (format ISO8601)
@prop {string} title - Title of article
@prop {string[]} address - Tawian Address format
@prop {string} cover - Url
@prop {string} body - HTML
@prop {string[]} images - Url
*/
Development flow
vi src/index.js:wqnpm testnpm run buildgit commit -m 'dev'
test
npm test