Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

radudotat/nodejs-meme-scraper-jan-2022

Repository files navigation

This repo will be discontinued and is nor archived. Do not use it!!!

Create a cli (Command Line Interface) application that scrapes this website:

https://memegen-link-examples-upleveled.netlify.app/

...and saves the first 10 images into a folder called "memes" within the directory of the new project. The image files should be named with a number with a leading zero, eg. 01.jpg, 02.jpg, etc.

Avoid using an "image scraper" or "image downloader" library that does multiple steps at once for you (eg. do not use image-downloader or nodejs-file-downloader or similar) - break the task down into smaller steps and select libraries as necessary for each step.

Make sure that the meme images are "ignored" in Git - they should not show up in your repository.

The program should be able to run multiple times without throwing an error.

TODOs

This is a placeholder for you to enter your todos.

Stretch goals:

  • Make the application create your own custom meme (eg. node index.js hello karl bender would download an image with the top text of "hello", the bottom text of "karl", with the meme image of Bender)
  • Add a nice progress indicator (either messages or a progress bar)

Acceptance Criteria

  • Preflight runs through without errors in your project
    • Link in your GitHub repo's About section: repl.it demo
  • Drone bot has been tagged and responded with a passing message
  • Correct GitHub commit message format (see Writing Commit Messages)

unresolved questions:

  • what does scrape mean?
    • extracting, taking information from some location

TODO

  • Create a folder called memes
  • Create a JavaScript file called index.js to hold the code
  • Create the .gitignore file
    • Add a new line at the bottom of the file with the name of the memes folder
  • Visit the memes website URL (the Netlify link)
    • Request the server for data (the server is the computer on which the website is saved) - also called "creating a request" or "connecting to the website"
    • The data returned will include an HTML string
  • Process the HTML string to create an array of image URLs
    • Search the website HTML for the src of the img tags (this will be the URL of the image)
  • Loop over the array of image URLs
    • Limit the loop to only the first ten images
    • Download the image data from the URL in a variable
    • Save the image data in the folder memes with the file names 01.jpg, 02.jpg, etc
  • Test the program by running node index.js multiple times