freecycle
A scraper for Freecycle.
Installation
You can install the scraper via NPM or yarn.
npm install --save freecycle
Usage
Import freecycle
into your project to begin scraping. You can use the getPosts
method to retrieve latest posts from a specified Freecycle group.
const freecycle = const GROUP_NAME = 'CambridgeUK' freecycle
The posts
array is an array of objects with the following string
fields:
name url location
More detail about each post can be retrieved using the getPostById
and getPostByURL
functions. Passing the url
field (from an array item returned by the getPosts
method) into getPostByURL
is the easiest way to retrieve further information about a post.
freecycle
The post
object, returned by either getPostBy
function, contains the following string
fields:
id type title location date description image
The image
field is undefined
or the URL of the post image.
Groups
There is also a Group
object, available by importing freecycle/group
. This abstracts the notion of an individual Freecycle group and allows multiple to be queried independently.
const Group = const group = 'CambridgeUK' group
See the 'multi.js' example for more details.
License
MIT