ubscraper

package module
v0.0.0-...-977fd26 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2018 License: MIT Imports: 5 Imported by: 0

README

userBenchmarkScraper GoDoc

A Golang library that scrapes devices and all available info for those devices that has been recorded on UserBenchmark.

Usage

/*
type PartInfo struct {
	Type      string  `csv:"Type"`        // Can be CPU, GPU, SSD, HDD, USB, or RAM
	PartNum   string  `csv:"Part Number"` // Part Number or Exact Model
	Brand     string  `csv:"Brand"`       // The brand of the product (Ex. EVGA)
	Model     string  `csv:"Model"`       // Title of item
	Rank      int     `csv:"Rank"`        // Ranking in benchmarks
	Benchmark float64 `csv:"Benchmark"`   // Average benchmark score for the item
	Samples   int     `csv:"Samples"`     // How many benchmarks were taken for the item
	URL       string  `csv:"URL"`         // The URL on UserBenchmark for the part
}
*/
// This finds the most tested CPU. Just change it from GetCPU() to getGPU(), etc. to get other device types
parts, _ := ubscraper.GetCPU() // Returns a slice of parts with the information above
sort.Slice(parts, func(i, j int) bool { return parts[i].Samples > parts[j].Samples })
fmt.Println(parts[0])

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PartInfo

type PartInfo struct {
	Type      string  `csv:"Type"`        // Can be CPU, GPU, SSD, HDD, USB, or RAM
	PartNum   string  `csv:"Part Number"` // Part Number or Exact Model
	Brand     string  `csv:"Brand"`       // The brand of the product (Ex. EVGA)
	Model     string  `csv:"Model"`       // Title of item
	Rank      int     `csv:"Rank"`        // Ranking in benchmarks
	Benchmark float64 `csv:"Benchmark"`   // Average benchmark score for the item
	Samples   int     `csv:"Samples"`     // How many benchmarks were taken for the item
	URL       string  `csv:"URL"`         // The URL on UserBenchmark for the part
}

PartInfo holds the information for a particular part which can be of type CPU, GPU, SSD, HDD, USB, or RAM

func GetCPU

func GetCPU() ([]PartInfo, error)

GetCPU downloads and unmarshals all CPU information and returns a slice of the parts of type PartInfo

func GetGPU

func GetGPU() ([]PartInfo, error)

GetGPU downloads and unmarshals all GPU information and returns a slice of the parts of type PartInfo

func GetHDD

func GetHDD() ([]PartInfo, error)

GetHDD downloads and unmarshals all HDD information and returns a slice of the parts of type PartInfo

func GetRAM

func GetRAM() ([]PartInfo, error)

GetRAM downloads and unmarshals all RAM information and returns a slice of the parts of type PartInfo

func GetSSD

func GetSSD() ([]PartInfo, error)

GetSSD downloads and unmarshals all SSD information and returns a slice of the parts of type PartInfo

func GetUSB

func GetUSB() ([]PartInfo, error)

GetUSB downloads and unmarshals all USB information and returns a slice of the parts of type PartInfo

func UnmarshalCSV

func UnmarshalCSV(filename string) ([]PartInfo, error)

UnmarshalCSV converts a UserBenchmark CSV into a variable of type PartInfo for easier use

Jump to

Keyboard shortcuts

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