Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
Merge pull request #2 from ilies-t/v0.1.0
  • Loading branch information
ilies-t committed Jul 22, 2020
2 parents aade604 + c443b96 commit c4f29b6
Show file tree
Hide file tree
Showing 21 changed files with 852 additions and 399 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# IDE
.idea
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Apache License
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2019 Ilies T
Copyright 2020 Ilies T

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
145 changes: 69 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Behance-node
[![NPM Version](https://img.shields.io/npm/v/behance-node.svg)](https://npmjs.org/package/behance-node)
[![Strict TypeScript Checked](https://badgen.net/badge/Built%20With/TypeScript)](https://www.typescriptlang.org)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

An asynchronous library to scrape Behance.
An asynchronous module for scrapping Behance using JavaScript.

## Install
```shell
Expand All @@ -13,90 +16,80 @@ const Behance = require('behance-node');
```

# Documentation
* [User informations](#user-informations)
* [User detailed informations](#user-detailed-informations)
* [Save user detailed informations](#save-user-detailed-informations)
* [Project informations](#project-informations)
* [Save project informations](#save-project-informations)
* [User data](#user-data)
* [Project data](#project-data)
* [Random project](#random-project)

## User informations
Return result about user
```js
Behance.user(`nicholaslosacco`)
.then((result) => {
console.log(result)
})
.catch((error) => {
console.log(error)
});
```

## User detailed informations
Return detailed result about user
```js
Behance.detailledUser(`nicholaslosacco`)
.then((detailledResult) => {
console.log(detailledResult)
})
.catch((error) => {
console.log(error)
});
```
## User data
Return data about user.
* Method:
* `user(username: string, detailed?: boolean)`
* Parameters:

## Save user detailed informations
Save user detailed result in JSON file
```js
let user = `nicholaslosacco`;
let directory = `datas-folder`;
| Name | Type | Info |
| ---------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `username` | string | Desired username |
| `detailed` | boolean | Return more detail about user or not |

Behance.saveDetailledUser(user, directory)
.then(() => {
console.log(`${user}.json saved in ${directory}`)
})
.catch((error) => {
console.log(error)
});
```
* Example:
* Get detailed data about this user `https://www.behance.net/moesalah`.
```js
Behance.user('moesalah', true)
.then( result => console.log(result) )
.catch( error => console.log(error) );
```

## Project informations
Return detailed result about project
```js
Behance.project(`75651921/Cirka-Free-Typeface`)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.log(error)
})
```
## Project data
Return data about project.
* Method:
* `project(path: string)`
* Parameter:

## Save project informations
Save project result in JSON file
```js
let project = `75651921/Cirka-Free-Typeface`;
let directory = `datas-folder`;
| Name | Type | Info |
| ---------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `path` | string | Desired project path, must contain project id and name |

Behance.saveProject(project, directory)
.then(() => {
console.log(`👌 saved`);
})
.catch((error) => {
console.log(error)
})
```
* Example:
* Get data about this project `https://www.behance.net/gallery/77156181/Amazon-Rebranding-UI-Concept`.
```js
Behance.project('77156181/Amazon-Rebranding-UI-Concept')
.then( result => console.log(result) )
.catch( error => console.log(error) );
```

## Random project
Return random project from trending
```js
Behance.randomProject()
.then((result) => {
console.log(result)
})
.catch((error) => {
console.log(error)
})
```
Get a random project data using sort.
* Method:
* `
randomProject(
sort?: 'recommended' | 'curated' | 'most_appreciated' | 'most_viewed' | 'most_commented' | 'most_recent',
time?: 'today' | 'this_week' | 'this_month' | 'all_time'
)
`
* Parameters:

| Name | Type | Info |
| ---------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `sort` | `recommended`, `curated`, `most_appreciated`, `most_viewed`, `most_commented`, `most_recent` | Only `most_appreciated`, `most_viewed`, `most_commented` can be used with `time` parameter |
| `time` | `today`, `this_week`, `this_month`, `all_time` | Sort result by date |

* Examples:
* Get a random project from most viewed this week.
```js
Behance.randomProject('most_viewed', 'this_week')
.then( result => console.log(result) )
.catch( error => console.log(error) );
```
* Get a random curated project.
```js
Behance.randomProject('curated')
.then( result => console.log(result) )
.catch( error => console.log(error) );
```

# Links
* [NPM Package](https://www.npmjs.com/package/behance-node)
* [Moe Salah - artist from documentation examples](https://www.behance.net/moesalah)

# License
[Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/)
32 changes: 32 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
`Date format: YYYY-DD-MM`<br/>
`Language: English`


0.0.1 / 2019-22-09
==================
* First release.


0.0.2 / 2019-22-09
==================
* Update NPM publication.


0.0.3 / 2019-08-10
==================
* Update comments and NPM publication.


0.1.0 / 2020-22-07
==================
* Move to typescript <3 .

* Improve the module and main methods code readability/safety by using TypeScript class.

* Delete all file-related functions.

* Better tests.

* Add filters for `randomProject()`.

* Change documentation skeleton.
31 changes: 0 additions & 31 deletions examples/project.js

This file was deleted.

31 changes: 0 additions & 31 deletions examples/user.js

This file was deleted.

13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
Behance-node v0.0.3
Project: https://github.com/ilies-t/behance-node
Author: ilies t <https://github.com/ilies-t>
License: Apache License 2.0
*/
/**
* Behance-node v0.1.0
*
* @link <a href="https://github.com/ilies-t/behance-node">GitHub repository</a>
* @author <a href="https://github.com/ilies-t">ilies t</a>
* @licence Apache Licence 2.0
*/

module.exports = require('./lib/Behance');
Loading

0 comments on commit c4f29b6

Please sign in to comment.