Skip to content

Commit

Permalink
Add summary for scraped sources from specfiles
Browse files Browse the repository at this point in the history
Closes packit/packit-service#2390

Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Aug 27, 2024
1 parent 0d50143 commit 92e4164
Show file tree
Hide file tree
Showing 8 changed files with 3,028 additions and 0 deletions.
49 changes: 49 additions & 0 deletions research/specfiles/hosting-sources/checker/checker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package main

import (
"bufio"
"log"
"net/http"
"os"
"time"

"github.com/k0kubun/go-ansi"
"github.com/schollz/progressbar/v3"
)

func main() {
// Construct the HTTP client
timeout, _ := time.ParseDuration("5s")
client := &http.Client{
Timeout: timeout,
}

// Open the file with domains
pathname := "../domains.txt"
file, err := os.Open(pathname)
if err != nil {
log.Fatal(err)
}
defer file.Close()

bar := progressbar.NewOptions(2095,
progressbar.OptionSetWriter(ansi.NewAnsiStdout()),
)

log.Printf("[INFO] Starting the checks…")

// Try each domain
scanner := bufio.NewScanner(file)
for scanner.Scan() {
url := scanner.Text()

_, err := client.Get(url)
if err == nil {
// log.Printf("[PASS] %v", url)
} else {
log.Printf("[FAIL] ‹%v› with ‹%v›", url, err)
}

bar.Add(1)
}
}
13 changes: 13 additions & 0 deletions research/specfiles/hosting-sources/checker/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/packit/research/research/specfiles/hosting-sources/checker

go 1.22.5

require (
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/schollz/progressbar/v3 v3.14.4 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
)
22 changes: 22 additions & 0 deletions research/specfiles/hosting-sources/checker/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213 h1:qGQQKEcAR99REcMpsXCp3lJ03zYT1PkRd3kQGPn9GVg=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
github.com/schollz/progressbar/v3 v3.14.4/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
371 changes: 371 additions & 0 deletions research/specfiles/hosting-sources/checker/log.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 92e4164

Please sign in to comment.