Skip to content

A little tool to fetch web pages and prepare them to send via email.

Notifications You must be signed in to change notification settings

knice/article-to-campus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AC (in development)

AC connotes delivery of electricity, but in this case is short for article-to-campus.

How it works

You provide a URL to a news article on news.ucsc.edu, and AC

  1. Fetches the HTML from the URL
  2. Sanitizes the HTML (remove unnecessary tags and attributes, make links fully-qualified)
  3. Pulls author and audience information out of the HTML
  4. Modifies the HTML (removes images, sharing links, and author information)
  5. Compiles a new template for the email and inserts the HTML
  6. Inlines a new CSS stylesheet so the message works with email clients like Gmail
  7. Uses the URL slug (filename on the website) to save the file in ./build/

Requirements

  • Node and NPM installed
  • Command line experience

Setup

  1. Clone this repo
  2. cd into the project directory
  3. Run npm install

Use

Run the following command to fetch a page:

node app.js [URL-to-fetch]

Example:

node app.js https://news.ucsc.edu/2019/07/frank-honduras-book.html

Prepares and saves the HTML content in ./build/frank-honduras-book.html

Roadmap

  • Modularize the individual parts of the script.
  • Make this into a full app that can send email too.
  • Remove the requirement that the file be saved before inlining.

References