nfx / go-htmltable Goto Github PK
View Code? Open in Web Editor NEWStructured HTML table data extraction from URLs in Go that has almost no external dependencies
Home Page: https://pkg.go.dev/github.com/nfx/go-htmltable
License: MIT License
Structured HTML table data extraction from URLs in Go that has almost no external dependencies
Home Page: https://pkg.go.dev/github.com/nfx/go-htmltable
License: MIT License
I needed something like this a couple of weeks ago and would love to see this working!
Unfortunately the first URL I tried resulted in a panic.
Not sure if it was because there are multiple tables on the page? Or maybe I misunderstood the API, let me know if there is a better way I should set this up to get it working.
2022/10/15 18:34:16 found table columns=[Model Code name Released CPU support Fab(nm) FSB/HT(MHz) Southbridge Features / Notes] count=7
2022/10/15 18:34:16 found table columns=[Model AMD480Xchipset(originally CrossFire Xpress 1600) Model RD480 Model Oct 2006 Model Athlon 64,Sempron Model 110 Model 1000(HT 2.0) Model No
Model x8 + x8 Model SB600,ULi-M1575 Model ? Codename Released CPU support Fab(nm) HT(MHz) IGP CrossFire Southbridge Features / Notes] count=26
2022/10/15 18:34:16 found table columns=[Model Codename Released CPU support Fab(nm) HT(MHz) AMD-V(Hardware Virtualization) IGP CrossFire SLI[5] TDP(W) Southbridge Features / Notes] co
unt=13
2022/10/15 18:34:16 found table columns=[Model AMD 640 chipset Model AMD-645 Model 1997 Model Model Model Model 2 ร ATA/33 Model Codename Released Fab(nm) USB2.0 + 1.1 Audio Parall
el ATA1 Features / Notes] count=14
2022/10/15 18:34:16 found table columns=[Model Codename Released Fab(nm) SATA USB2.0 + 1.1 Parallel ATA1 RAID NIC Package TDP(W) Features / Notes] count=12
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
github.com/nfx/go-htmltable.(*Page).finishTable(0xc000207d18)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:273 +0x867
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc0004e80e0)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:219 +0x427
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc00026bce0)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:222 +0x45a
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc00026bc70)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:222 +0x45a
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc00026b500)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:222 +0x45a
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc00026aee0)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:222 +0x45a
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc00026acb0)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:222 +0x45a
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc000226a10)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:222 +0x45a
github.com/nfx/go-htmltable.(*Page).parse(0xc000207d18, 0xc000226930)
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:222 +0x45a
github.com/nfx/go-htmltable.(*Page).init(0x68d300?, {0x7f3d447d5830?, 0xc00049c180?})
GOPATH/pkg/mod/github.com/nfx/[email protected]/page.go:186 +0x57
github.com/nfx/go-htmltable.NewSlice[...]({0x71c310, 0xc00001a100?}, {0x7f3d447d5830?, 0xc00049c180?})
GOPATH/pkg/mod/github.com/nfx/[email protected]/slice.go:17 +0x90
github.com/nfx/go-htmltable.NewSliceFromResponse[...](0x6b0fb8?)
GOPATH/pkg/mod/github.com/nfx/[email protected]/slice.go:30 +0x8c
github.com/nfx/go-htmltable.NewSliceFromURL[...]({0x6b0fb8, 0x407ab9?})
GOPATH/pkg/mod/github.com/nfx/[email protected]/slice.go:43 +0xc8
main.main()
HOME/intros/html-tables/main.go:23 +0x30
exit status 2
go1.19.1 linux/amd64
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.