0.1.1 • Published 6 years ago

node-jeuxvideo-bot-api v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Node.js Jeuxvideo.com Forum API

Node.js module to interact with unofficial Jeuxvideo.com Forum API. A jeuxvideo.com's account is needed, to post message on topic.

Install

npm install --save node-jeuxvideo-bot-api

Table of contents

Cheat Sheet

const Jvc = require('node-jeuxvideo-bot-api');

Authentification on JVC by credentials

const jvc = new Jvc({
  username: 'MYUSERNAME',
  password: 'MYPASSWORD'
});

jvc.login().then( () => {
  // do stuff
}).catch(console.err);

Authentification on JVC by cookie

const jvc = new Jvc({
  loginFromCookies: {
    coniunctio: 'Coniunctio cookie value'
  }
});

jvc.login().then( () => {
  // do stuff
}).catch(console.err);

Get common forums list

jvc.getForumsList().then((forums) => {
  console.log(forums);
  /**
  * Displays
  * [
  *   {
  *     forumName: 'xxxx',
  *     forumUrl: 'xxxx'
  *   },
  *   {
  *     forumName: 'xxxx',
  *     forumUrl: 'xxxx'
  *   }
  * ]
  **/ 
}).catch(console.err);

Get topics from forum url

jvc.getTopicsFromForum('http://www.jeuxvideo.com/forums/0-3010442-0-1-0-1-0-football-manager-2018.htm').then((topics) => {
  console.log(topics);
  /**
  * Displays
  * {
  *   topics: [
  *     {
  *       id: '54842501'
  *       subject: 'Blabla'
  *       count: 12
  *       author: 'Blabla'
  *       pinned: false
  *       lastUpdate: '20/01/18'
  *       firstPageUrl: '/forums/xxxx.html'
  *       lastPageUrl: '/forums/xxxx.html'
  *     },
  *     ...
  *   ],
  *   next: '/forums/0-3010442-0-1-0-26-0-football-manager-2018.htm',
  *   previous: ''
  * }
  **/ 
}).catch(console.err);

Search topics from forum url with a keyword and a mode 0 => title, 1 => author and 2 => message

jvc.getTopicsFromForumSearch('http://www.jeuxvideo.com/forums/0-3010442-0-1-0-1-0-football-manager-2018.htm', 'game', 0).then((topics) => {
  console.log(topics);
  /**
  * Displays
  * {
  *   topics: [
  *     {
  *       id: '54842501'
  *       subject: 'gane ddfdf'
  *       count: 12
  *       author: 'Blabla'
  *       pinned: false
  *       lastUpdate: '20/01/18'
  *       firstPageUrl: '/forums/xxxx.html'
  *       lastPageUrl: '/forums/xxxx.html'
  *     },
  *     ...
  *   ],
  *   next: '/recherche/forums/0-3010442-0-1-0-26-0-football-manager-2018.htm',
  *   previous: ''
  * }
  **/ 
}).catch(console.err);

Get posts from topic url

jvc.getPostsFromTopic('http://www.jeuxvideo.com/forums/42-3010442-53927408-1-0-1-0-topic-de-moderation.htm').then((posts) => {
  console.log(posts);
  /**
  * Displays
  * {
  *   posts: [
  *     {
  *       id: '54842501'
  *       author: 'Blabla'
  *       pinned: false
  *       createdDate: '20 janvier 2018 à 21:01:01'
  *       content: 'Blabla blabla'
  *     },
  *     ...
  *   ],
  *   next: '/forums/42-3010442-53927408-2-0-1-0-topic-de-moderation.htm',
  *   previous: ''
  * }
  **/ 
}).catch(console.err);

Send message on topic url

jvc.sendMessage('Blablabla','http://www.jeuxvideo.com/forums/42-3010442-53927408-1-0-1-0-topic-de-moderation.htm').then(() => {
  //do stuff
}).catch(console.err);

More examples

To see more examples, click here

Configuration

ParamTypeDefaultDescription
usernameStringEmptyUsername credential for JVC
passwordStringEmptyPassword credential for JVC
loginFromCookieObject{}Connection cookie coniunctio, loginFromCookie.coniunctio: 'value'

License

The MIT License (MIT)

Copyright (c) 2017 Kakulukian

0.1.1

6 years ago

0.1.0

6 years ago

0.0.13

6 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago