Code Monkey home page Code Monkey logo

create-meme-scraper's People

Contributors

nigorita avatar

Watchers

 avatar  avatar

create-meme-scraper's Issues

Memes folder name

The memes folder name should be memes, not Pix.

Not a huge deal, but:

  • small details like this can be important in projects
  • uppercase letters in file and folder names can cause problems (especially cross platform - between Linux and Windows, for example)

Unused Variables / Variables Declared with Var

Some variables can be declared with const instead of var:

var fs = require("fs");
var https = require("https");
var decode = require("decode-html");

var fullUrl = url;
var file = fs.createWriteStream(localPath);
var request = https.get(url, function(response) {

Using const instead will prevent some unusual bugs and prevent the variables from being accidentally reassigned.

Also, some of those variables are unused (not used anywhere else), so probably don't even need to be assigned:

Screen Shot 2019-09-27 at 14 28 52

Screen Shot 2019-09-27 at 14 28 46

You can see the unused variables because their colors are not as bright as the other ones.

Variable Naming / Reuse

The naming of some of the variables could be improved to better communicate to others what they actually are - eg. body1, body2, itm:

const body1 = body.match(/ src.+watermark=none/g);

const body2 = body1.map(itm => {

Another "best practices" thing is to not reuse / reassign the value of parameters (not a huge deal, but some teams may not allow this):

itm = itm.match(/\/.+watermark=none/);
itm = "https://memegen.link" + itm;
// itm = decode(itm);
itm = itm.replace("'", "'");
itm = itm.replace("'", "'");
itm = itm.replace("โ€™", "'");

Nice use of a function!

Nice use of a function to separate out some of the code:

function saveImageToDisk(url, localPath) {
var fullUrl = url;
var file = fs.createWriteStream(localPath);
var request = https.get(url, function(response) {
response.pipe(file);
});
}

Images saved to Git / GitHub

Using your .gitignore file you can ignore the images folder so that it doesn't show up on GitHub.

In order to do this, you can try googling "gitignore folder".

Otherwise they will be on GitHub and will be downloaded when people download your program:

Screen Shot 2019-09-27 at 14 26 12

To ignore the things that are downloaded by the program is often considered best practice.

Extra debugging output / show progress in output

When the program is run, extra output appears in the terminal (see screenshots below). It would be nice to have the output free of this extra debugging information.

Screen Shot 2019-09-28 at 14 03 33

Screen Shot 2019-09-28 at 14 05 07

On the other side of things, it would also be good to have a progress indicator for the download of each image. This could be shown as either a message before and/or after each image or even better, a progress meter.

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.