GithubHelp home page GithubHelp logo

awesome-archive / javlibrary-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from magicknight/javlibrary-api

0.0 2.0 0.0 122 KB

๐Ÿ This repo name is fully encapsulated.

JavaScript 99.51% Python 0.49%

javlibrary-api's Introduction

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.

javlibrary-api's People

Contributors

ken113 avatar trazyn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.