makescraper

command module
v0.0.0-...-115c6bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 4 Imported by: 0

README ΒΆ


makescraper is a simple API for scraping website data. Just pass in the url and keywords you are looking for and have the scraper return you json.


gitmoji-changelog


πŸ“š Table of Contents

  1. Project Structure
  2. Installation
  3. Deliverables
  4. Resources

Project Structure

πŸ“‚ makescraper
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ go.mod
β”œβ”€β”€ go.sum
β”œβ”€β”€ server.go
β”œβ”€β”€ assets
β”‚   β”œβ”€β”€ css
β”‚   β”‚   └── styles.css
β”‚   β”œβ”€β”€ fonts
β”‚   β”œβ”€β”€ img
β”‚   β”‚   └── thumbnail.jpg
β”‚   β”œβ”€β”€ js
β”‚   β”‚   └── scripts.min.js
β”‚   └── svg
β”œβ”€β”€ config
β”œβ”€β”€ controllers
β”‚   └── url.go
β”œβ”€β”€ crawler
β”‚   └── scrape.go
β”œβ”€β”€ docs
β”‚   └── media
β”‚       β”œβ”€β”€ form.png
β”‚       └── logo.jpg
β”œβ”€β”€ json
β”‚   └── serilization.go
β”œβ”€β”€ models
β”‚   └── site.go
β”œβ”€β”€ parser
└── templates
    └── index.html

πŸš€ Installation

Homebrew


Deliverables

Scraping

  • IMPORTANT: Complete the Web Scraper Workflow worksheet distributed in class.
  • Create a struct to store your data.
  • Refactor the c.OnHTML callback on line 16 to use the selector(s) you tested while completing the worksheet.
  • Print the data you scraped to stdout.
Stretch Challenges
  • Add more fields to your struct. Extract multiple data points from the website. Print them to stdout in a readable format.

Serializing & Saving

  • Serialize the struct you created to JSON. Print the JSON to stdout to validate it.
  • Write scraped data to a file named output.json.
  • Add, commit, and push to GitHub.
Stretch Challenges
  • TBA 02/10!

Resources

Lesson Plans

Example Code

Scraping

Serializing & Saving

  • JSON to Struct: Paste any JSON data and convert it into a Go structure that will support storing that data.
  • GoByExample - JSON: Covers Go's built-in support for JSON encoding and decoding to and from built-in and custom data types (structs).
  • GoByExample - Writing Files: Covers creating new files and writing to them.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL