Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

acb-api

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acb-api - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

23

index.js

@@ -1,2 +0,2 @@

const axios = require('axios').default;
const axios = require('axios').default, c = require('cheerio');
const opt = {

@@ -31,2 +31,20 @@ headers: {

}
async function get_character_amount(){
const res = await axios({url: 'https://www.animecharactersdatabase.com/charactershub.php?load=c_latest', method: 'get'}), $ = c.load(res.data);
let number = 0;
$('h3').each((idx, el) => {
if(el.children[0].data){
if(el.children[0].data.toLowerCase().includes('characters')){
const new_number = parseInt(el.children[0].data.split(/ +/)[0]);
number = new_number;
}
}
});
return number;
}
async function get_random_character(){
const allIDs = await get_character_amount(), url = `http://www.animecharactersdatabase.com/api_series_characters.php?character_id=${Math.floor(Math.random() * allIDs)}`;
const res = await axios({url: url, method: 'get', opt});
return res.data;
}
module.exports = {

@@ -36,3 +54,4 @@ get_character_by_id,

get_character_by_search,
get_anime_by_search
get_anime_by_search,
get_random_character
}

5

package.json
{
"name": "acb-api",
"version": "1.3.4",
"version": "1.3.5",
"description": "a api that uses the animecharacterdatabase and access information from there",

@@ -21,4 +21,5 @@ "main": "index.js",

"dependencies": {
"axios": "^0.21.1"
"axios": "^0.21.1",
"cheerio": "^1.0.0-rc.5"
}
}

@@ -127,2 +127,14 @@ # ACB Information Api

}
get_random_character returns:
{
"id": 666,
"anime_id": 90,
"anime_image": "http://ami.animecharactersdatabase.com/productimages/90.jpg",
"character_image": "http://ami.animecharactersdatabase.com/./images/maihime/Reito_thumb.jpg",
"origin": "Mai-HiME - The Genealogical Tree of Fate",
"gender": "Male",
"name": "Reito Kanzaki",
"desc": "Reito Kanzaki is a character from the visual novel Mai-HiME - The Genealogical Tree of Fate."
}
```

@@ -13,2 +13,5 @@ const a = require('./index');

console.log(res);
});
a.get_random_character().then(res => {
console.log(res);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc