GithubHelp home page GithubHelp logo

website-scraper / website-scraper-existing-directory Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 4.0 61 KB

Plugin for website-scraper which allows to save resources to existing directory

Home Page: https://www.npmjs.com/package/website-scraper-existing-directory

License: MIT License

JavaScript 100.00%
nodejs javascript website-scraper hacktoberfest

website-scraper-existing-directory's Introduction

Version Downloads Node.js CI Coverage Status Test Coverage Maintainability

website-scraper-existing-directory

Plugin for website-scraper which allows to save resources to existing directory.

Please keep in mind that saving to existing directory may overwrite your files. Be careful with it!

Requirements

  • nodejs version >= 14.14
  • website-scraper version >= 5

Installation

npm install website-scraper website-scraper-existing-directory

Usage

import scrape from 'website-scraper';
import SaveToExistingDirectoryPlugin from 'website-scraper-existing-directory';

await scrape({
    urls: ['http://example.com'],
    directory: '/path/to/save',
    plugins: [ new SaveToExistingDirectoryPlugin() ]
});

website-scraper-existing-directory's People

Contributors

aivus avatar dependabot[bot] avatar s0ph1e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

website-scraper-existing-directory's Issues

Usage in electronJS throws an error which says: SaveToExistingDirectoryPlugin not a constructor

I am using this in the main.js of an electron application.
My imports look like this:
const scrape = (...args) => import('website-scraper').then(({default:scrape})=>scrape(...args)); const SaveToExistingDirectoryPlugin = (...args) => import('website-scraper-existing-directory').then(({default:SaveToExistingDirectoryPlugin})=>SaveToExistingDirectoryPlugin(...args));
My scrape options like this:
let options = { urls: [url], directory: cache_dir, plugins: [ new SaveToExistingDirectoryPlugin() ] }
Then I execute scrape with the options:
scrape(options).then(...)
This throws an error which says "SaveToExistingDirectoryPlugin is not a constructor"

How to resolve this

Charset on final file is not like expected

Configuration

version: [email protected]

options: [provide your full options object]

const options = {
  urls: ['https://www.appmasters.io/pt/'],
  directory: '/Users/tiagogouvea/www/scrapper/test/app/',
  plugins: [ new SaveToExistingDirectoryPlugin() ]
};

Description

Trying to scrap a website that has <meta charSet="utf-8"/> results on a content without correct charset presentation.

Following is a screenshot showing the original content and the scrapped one.

Cursor_and_App_Masters_-_Desenvolvimento_web_e_mobile_-_App_Masters_-_Desenvolvimento_Web_e_Mobile_-_Juiz_de_Fora_MG

Expected behavior: That the save filed was on the same charset.

Actual behavior: It failed to save on the current way.

Additional Information

Congratulations for this amazing project! ๐Ÿ‘๐Ÿ‘๐Ÿ‘

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.