GithubHelp home page GithubHelp logo

facundovictor / jsfiddle-downloader Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 10.0 96 KB

It allows to download all your jsFiddles' scripts, just using a NodeJS script

License: MIT License

JavaScript 98.91% Dockerfile 1.09%
jsfiddle jsfiddle-downloader nodejs fiddle

jsfiddle-downloader's Introduction

jsfiddle-downloader

Build Status npm version GitHub license Total Downloads FOSSA Status

Download fiddles from jsFiddle.net, just using a NodeJS script and save it as a single HTML file.

NPM

Installation:

    npm install jsfiddle-downloader -g

How to use it:

  Usage: jsfiddle-downloader [options]

  Options:

        -h, --help                        output usage information
        -V, --version                     output the version number
        -u, --user <user>                 Save all the users fiddles
        -l, --link <url>                  Url of the fiddle to save
        -o, --output <path>               Target path to download the data
        -c, --compressed                  Compress the spaces of the HTML output
        -i, --identifier <fiddle_id>      Identifier of the fiddle to save
        -f, --force-http                  Use http when the URI method is undefined
        -v, --verbose                     Verbose output
        -I, --filename-identifier         Use fiddle identifier as filename (default)
        -T, --filename-title              Use fiddle title as filename
        -IT, --filename-identifier-title  Use fiddle identifier and title as filename
        -S, --filename-spaces             Keep spaces in filename (default: replace by underscores)

To download a single fiddle from its id:

  jsfiddle-downloader -i <fiddle-id> [-o <output file>] [-f]

To download a single fiddle from its url:

  jsfiddle-downloader -l <url> [-o <output file>]
  jsfiddle-downloader -l jsfiddle.net/<user>/<fiddle-id>
  jsfiddle-downloader -l jsfiddle.net/<user>/<fiddle-id>/<version>
  jsfiddle-downloader -l https://jsfiddle.net/<fiddle-id>
  jsfiddle-downloader -l https://jsfiddle.net/<fiddle-id>/<version>
  jsfiddle-downloader -l https://jsfiddle.net/<user>/<fiddle-id>/show/ -o myfiddle.html

To download all scripts of a determinated 'user' from jsFiddle.net:

  jsfiddle-downloader -u <user> [-o <output file>]

It'll download all backups in the currrent directory, the jsFiddles scripts will be named by default as:

  [<output-folder>/]<id-fiddle>.html

To save the files using the fiddle's title, provide the parameter -T:

  jsfiddle-downloader -T -u <user> [-o <output file>]

It'll download all backups in the currrent directory, the jsFiddles scripts will be named as:

  [<output-folder>/]<title-fiddle>.html

To avoid running a local server for resolving URIs that doesn't have an URI method defined. Use the -f parameter:

  jsfiddle-downloader -f -i <fiddle-id>
  jsfiddle-downloader -f -l <url>
  jsfiddle-downloader -f -u <user>

This will replace all the http:// in the href of link tags and in the src of script tags.

You can make the filenames more informative with these options:

-T : <fiddle-title>.html (title given to the fiddle to make it public)

-IT: <fiddle-id>_<fiddle-title>.html (combined identifier and title)

-S : Keep spaces in filename (default: replace by underscores)

Tests:

In the project directory jsfiddle-downloader run

mocha test [--keep]

If you run tests with option --keep, the temporary directories containing html files downloaded during tests will be preserved for inspection.

License

FOSSA Status

jsfiddle-downloader's People

Contributors

facundovictor avatar fossabot avatar jgleal avatar rudifa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jsfiddle-downloader's Issues

'Retreive' is a spelling mistake, should be 'Retrieve'

Expected:

~ $ jsfiddle-downloader -v -i 5deked8L
Retrieve chunk
. . .

Actual:

~ $ jsfiddle-downloader -v -i 5deked8L
Retreive chunk
. . .

Note: as I type this comment, even the github spelling checker flags 'retreive' as suspect.
P.S. Thank you for this neat utility.

Save jsfiddle source as separate files

When jsfiddle is downloaded, only the Result is stored in output html file.

But this is not enough to make a backup of a fiddle. Is it possible to save HTML, JS and CSS tabs in separate files for a fiddle?

Bug: Can't download an specific version

It seems that if I run...

	jsfiddle-downloader -l https://jsfiddle.net/[auser]/[acode]/10/ -o dlFiddle.html

...jsfiddle-downloader will download whatever version is set to base . It'd be neat to download the version to which the input url points.

Omitting trailing slash in fiddle url leads to 404

I noticed that if I omit the trailing slash in a fiddle url then the file downloaded will be the jsfiddle 404 page. Example:

jsfiddle-downloader -l https://jsfiddle.net/tdreid/w9qg0gwh -o dlFiddle.html
Detected fiddle code = tdreid
Output file = dlFiddle.html

(note that 'detected fiddle code' reports the user not the fiddle)
dlFiddle.html will be...

jsfiddle-downloader-2017-01-04-20-28-05

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.