Skip to content

🐝 This repo name is fully encapsulated.

Notifications You must be signed in to change notification settings

magicknight/javlibrary-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hero

🐝 This repo name is fully encapsulated.

This is a universal wrapper/scraper for the javlibrary.com that runs on Nodejs.

Installation

npm i ken113/javlibrary-api

Usage

The first thing is bypass Cloudflare's anti-bot page, all the content access need with session.

import jav from 'javlibrary-api';

jav.config(
    {
        headers: {
            'User-Agent': 'required'
            'Cookie': 'required'
        }
    }
);

(
    async() => {
        var res = await jav.getVideoDetail('javliida3q');
        console.log(res);
    }
)();

Sample

There are a lot of samples πŸ€— If you're trying to figure out how to use an API, look there first!

npm run sample -- ./sample/search.js

Session

Run the command generate a session file:

npm run session

There has a example how to keep a fresh session:

import time
import cfscrape
import schedule


def job():
    tokens, user_agent = cfscrape.get_cookie_string('http://www.javlibrary.com/') # noqa
    with open('../session.txt', 'w') as file:
        file.write('{}+{} \r\n'.format(tokens, user_agent))


job()
schedule.every(30).minutes.do(job)

while 1:
    schedule.run_pending()
    time.sleep(1)

Use the session file:

var jav = require('../index');
var fs = require('fs');
var path = require('path');

module.exports = () => {
    var session = fs.readFileSync(path.resolve(__dirname, '../session.txt'), { encoding: 'utf-8' });

    var [cookie, userAgent] = session.split('+');

    jav.config(
        {
            headers: {
                'User-Agent': userAgent.trim(),
                'Cookie': cookie.trim()
            }
        }
    );

    return jav;
};

API Reference

Functions

getBestRated(options) β‡’ object | undefined

Get the best rated items

getBestReviews(options) β‡’ object | undefined

Get the best review items

getMostFavStars() β‡’ object | undefined

Get the most favorited items

getMostWanted(options) β‡’ object | undefined

Get the most wanted items

getNewComments(options) β‡’ object | undefined

Get the newest commented items

getNewEntries(options) β‡’ object | undefined

Get the newest entries items

getNewReleases(options) β‡’ object | undefined

Get the newest released items

getPopularVideo() β‡’ object | undefined

Get the most popular items

getVideoComments(id) β‡’ object | undefined

Get the comments by item id

getVideoDetail(id) β‡’ object | undefined

Get the detail by item id

getVideoReviews(id) β‡’ object | undefined

Get the reviews by item id

listByDirector(options) β‡’ object | undefined

Get items by director id

listByLabel(options) β‡’ object | undefined

Get items by label id

listByMaker(options) β‡’ object | undefined

Get items by maker id

listByStar(options) β‡’ object | undefined

Get items by star id

listByTag(options) β‡’ object | undefined

Get items by tag id

search(keywords) β‡’ object | undefined

Get the detail by item id

getBestRated(options) β‡’ object | undefined

Get the best rated items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.order number 0 is order by DESC, 1 is order by ASC.
options.page number The page index.

getBestReviews(options) β‡’ object | undefined

Get the best review items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.order number 0 is order by DESC, 1 is order by ASC.

getMostFavStars() β‡’ object | undefined

Get the most favorited items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

getMostWanted(options) β‡’ object | undefined

Get the most wanted items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.order number 0 is order by DESC, 1 is order by ASC.
options.page number The page index.

getNewComments(options) β‡’ object | undefined

Get the newest commented items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.page number The page index.

getNewEntries(options) β‡’ object | undefined

Get the newest entries items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.page number The page index.
options.order number 0 is order by DESC, 1 is order by ASC.

getNewReleases(options) β‡’ object | undefined

Get the newest released items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.page number The page index.
options.order number 0 is order by DESC, 1 is order by ASC.

getPopularVideo() β‡’ object | undefined

Get the most popular items

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

getVideoComments(id) β‡’ object | undefined

Get the comments by item id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
id string ID of the item

getVideoDetail(id) β‡’ object | undefined

Get the detail by item id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
id string ID of the item

getVideoReviews(id) β‡’ object | undefined

Get the reviews by item id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
id string ID of the item

listByDirector(options) β‡’ object | undefined

Get items by director id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.id number The director id.
options.page number The page index.

listByLabel(options) β‡’ object | undefined

Get items by label id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.id number The label id.
options.page number The page index.

listByMaker(options) β‡’ object | undefined

Get items by maker id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.id number The maker id.
options.page number The page index.

listByStar(options) β‡’ object | undefined

Get items by star id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.id number The star id.
options.page number The page index.

listByTag(options) β‡’ object | undefined

Get items by tag id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
options object The pagination info.
options.id number The tag id.
options.page number The page index.

search(keywords) β‡’ object | undefined

Get the detail by item id

Kind: global function
Returns: object | undefined - A object the if successful. If failure not returned.

Param Type Description
keywords string Number plate.

About

🐝 This repo name is fully encapsulated.

Resources

Stars

Watchers

Forks

Packages

No packages published