1.1.3 • Published 5 years ago

uesp-fetch v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

uesp-fetch

uesp.net web crawler using node-fetch.

NPM

Features

This npm package allows users to fetch information from the uesp.net website.

Users can either provide a direct link to fetch a specific page or use an implemented search feature.

The functions return a promise. Once the promise is resolved you can access an object containing an url, page, category, thumbnail, description and paragraphs.

The description is the most relevant paragraph to your search query or, in the case of fetching a page, the first paragraph about the subject. Any additional paragraphs are saved in an array and might be unrelated to the search, but can still be accessed.

Example

const UESP = require('uesp-fetch.js');

// Using .then()/.catch()

UESP.search('whiterun')
.then(page => console.log(page))
.catch(err => console.log(err));

UESP.fetch('https://en.uesp.net/wiki/Oblivion:Adoring_Fan')
.then(page => console.log(page))
.catch(err => console.log(err));

// Using async/await

async function test() {
    try {
        const page = await UESP.search('lore:khajiit');
        console.log(page);
    } catch (err) { return; }
    try {
        const page = await UESP.fetch('https://en.uesp.net/wiki/Skyrim:Skyrim');
        console.log(page);
    } catch (err) { return; }
}

test();

// Accessing object properties

UESP.search('morrowind')
.then(page => {
    console.log(page.url);
    console.log(page.name);
    console.log(page.category);
    console.log(page.thumbnail);
    console.log(page.description);
    page.paragraphs.forEach(paragraph => {
        console.log(paragraph);
    });
}).catch(err => console.log(err));

// Or

async function getObjectProperties() {
    try {
        const page = await UESP.search('molag bal');
        console.log(page.url);
        console.log(page.name);
        console.log(page.category);
        console.log(page.thumbnail);
        console.log(page.description);
        page.paragraphs.forEach(paragraph => {
            console.log(paragraph);
        });
    } catch (err) { return; }
}

getObjectProperties();
1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago