{"id":27262271,"url":"https://github.com/brandenc40/safer","last_synced_at":"2025-04-11T05:49:45.237Z","repository":{"id":57623347,"uuid":"396448858","full_name":"brandenc40/safer","owner":"brandenc40","description":"An API to scrape data from the Department of Transportation's Safety and Fitness Electronic Records (SAFER) System.","archived":false,"fork":false,"pushed_at":"2022-10-31T20:18:49.000Z","size":83,"stargazers_count":6,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T05:49:39.838Z","etag":null,"topics":["company","dot","fmcsa","golang","mc","mx","safer","scaping","scrape","scraper","snapshot","usdot","webscraping"],"latest_commit_sha":null,"homepage":"https://safer.fmcsa.dot.gov/CompanySnapshot.aspx","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brandenc40.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-15T18:22:34.000Z","updated_at":"2024-10-20T12:39:35.000Z","dependencies_parsed_at":"2022-08-30T11:52:07.434Z","dependency_job_id":null,"html_url":"https://github.com/brandenc40/safer","commit_stats":null,"previous_names":["brandenc40/go-safer"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandenc40%2Fsafer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandenc40%2Fsafer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandenc40%2Fsafer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandenc40%2Fsafer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brandenc40","download_url":"https://codeload.github.com/brandenc40/safer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351428,"owners_count":21089271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["company","dot","fmcsa","golang","mc","mx","safer","scaping","scrape","scraper","snapshot","usdot","webscraping"],"created_at":"2025-04-11T05:49:44.653Z","updated_at":"2025-04-11T05:49:45.223Z","avatar_url":"https://github.com/brandenc40.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SAFER Scraper API [GoLang]\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/brandenc40/go-safer)](https://goreportcard.com/report/github.com/brandenc40/go-safer)\n[![Go Reference](https://pkg.go.dev/badge/github.com/brandenc40/safer.svg)](https://pkg.go.dev/github.com/brandenc40/safer)\n[![codecov](https://codecov.io/gh/brandenc40/safer/branch/master/graph/badge.svg?token=4BSF2R1OGP)](https://codecov.io/gh/brandenc40/safer)\n[![Tests](https://github.com/brandenc40/safer/actions/workflows/go.yml/badge.svg)](https://github.com/brandenc40/safer/actions/workflows/go.yml)\n\nAn API to scrape data from the Department of Transportation's Safety and Fitness Electronic Records \n([SAFER](https://safer.fmcsa.dot.gov/CompanySnapshot.aspx)) System.\n\nScraping is performed using [htmlquery](https://github.com/antchfx/htmlquery), this project's only non std lib dependency.\n\n\n## Installation\n\n```shell\ngo get -u github.com/brandenc40/safer\n```\n\n## Client Methods\n\n```go\n// GetCompanyByDOTNumber - Get a company snapshot by the companies DOT number. Returns ErrCompanyNotFound if\n// no company is found\nfunc (c *Client) GetCompanyByDOTNumber(dotNumber string) (*CompanySnapshot, error)\n\n// GetCompanyByMCMX - Get a company snapshot by the companies MC/MX number. Returns ErrCompanyNotFound if no\n// company is found.\n//\n// Note: do not include the prefix. (e.g. use \"133655\" not \"MC-133655\")\nfunc (c *Client) GetCompanyByMCMX(mcmx string) (*CompanySnapshot, error)\n\n// SearchCompaniesByName - Search for all carriers with a given name. Name queries will return the best matched results\n// in a slice of CompanyResult structs.\nfunc (c *Client) SearchCompaniesByName(name string) ([]CompanyResult, error)\n```\n\n### Build a new Client\n\n```go\npackage main\n\nimport (\n\t\"github.com/brandenc40/safer\"\n)\n\nfunc main() {\n\tclient := safer.NewClient()\n\t//... use the client\n}\n```\n\n### Scraping Benchmark\n\nBenchmarks only test the time taken to parse the html and map it back to the output. Server time is ignored here.\n\n```shell \ngoos: darwin\ngoarch: arm64\npkg: github.com/brandenc40/safer\nBenchmarkClient_GetCompanyByDOTNumber-8             9145            132111 ns/op           91557 B/op       2672 allocs/op\nBenchmarkClient_Search_4Results-8                  94274             12821 ns/op            9559 B/op        285 allocs/op\nBenchmarkClient_Search_484Results-8                 1048           1137919 ns/op          826245 B/op      24774 allocs/op\nPASS\nok      github.com/brandenc40/safer     4.942s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandenc40%2Fsafer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandenc40%2Fsafer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandenc40%2Fsafer/lists"}