Skip to content

Commit

Permalink
dotnet
Browse files Browse the repository at this point in the history
  • Loading branch information
moqsien committed Mar 14, 2024
1 parent 1aff1cc commit 7fb753a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 27 deletions.
21 changes: 7 additions & 14 deletions pkgs/pxy/main.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
package main

import (
"os"

"github.com/gvcgo/collector/pkgs/confs"
"github.com/gvcgo/collector/pkgs/versions"
)

func main() {
// sites.TestEDomains()
// sites.TestEDCollector()
// sites.TestTDomains()
os.Setenv(confs.ToEnableProxyEnvName, "true")
// app := NewApp()
// app.Run()
// os.Setenv(confs.ToEnableProxyEnvName, "true")
app := NewApp()
app.Run()

cfg := confs.NewCollectorConf()
// cfg := confs.NewCollectorConf()
// aj := versions.NewAdoptiumJDK(cfg)
// aj.FetchAll()
// aj.Upload()
Expand Down Expand Up @@ -75,7 +68,7 @@ func main() {
// scala.FetchAll()
// scala.Upload()

dn := versions.NewDotNet(cfg)
dn.FetchAll()
dn.Upload()
// dn := versions.NewDotNet(cfg)
// dn.FetchAll()
// dn.Upload()
}
47 changes: 34 additions & 13 deletions pkgs/versions/dotnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (d *DotNet) getDoc() {
os.Exit(1)
}
} else {
fmt.Printf("Failed: %s, code: %d", d.homepage, sCode)
fmt.Printf("Failed: %s, code: %d\n", d.homepage, sCode)
}
}

Expand All @@ -88,8 +88,10 @@ func (d *DotNet) fetchVersion(vUrl, vStr string) {
os.Exit(1)
}
} else {
fmt.Printf("Failed: %s, code: %d", d.homepage, sCode)
fmt.Printf("Failed: %s, code: %d\n", d.homepage, sCode)
return
}

link := doc.Find("a#directLink").AttrOr("href", "")
sha512Str := doc.Find("input#checksum").AttrOr("value", "")
sumType := "SHA512"
Expand Down Expand Up @@ -149,20 +151,39 @@ func (d *DotNet) FetchAll() {
if d.doc == nil {
continue
}

vInfo := d.doc.Find("div.download-panel").Find("div").Find("table").Eq(0).Find("caption").AttrOr("id", "")
vList := strings.Split(vInfo, "-sdk-")
vStr := vList[len(vList)-1]
// //div[@class="download-panel"]//div//table[1]
d.doc.Find("div.download-panel").Find("div").Find("table").Eq(0).Find("a").Each(func(_ int, s *goquery.Selection) {
uu := s.AttrOr("href", "")
if filterDotNetSDKByUrl(uu) {
if !strings.Contains(uu, d.host) {
uu, _ = url.JoinPath(d.host, uu)
}
d.fetchVersion(uu, vStr)
d.doc.Find("div.download-panel").Find("div").Find("table").Each(func(i int, ss *goquery.Selection) {
vInfo := ss.Find("caption").AttrOr("id", "")
vList := strings.Split(vInfo, "-sdk-")
if len(vList) < 2 {
return
}
vName := vList[len(vList)-1]
ss.Find("a").Each(func(i int, sa *goquery.Selection) {
uu := sa.AttrOr("href", "")
if filterDotNetSDKByUrl(uu) {
// fmt.Println(uu)
if !strings.Contains(uu, d.host) {
uu, _ = url.JoinPath(d.host, uu)
}
d.fetchVersion(uu, vName)
}
})
})

// vInfo := d.doc.Find("div.download-panel").Find("div").Find("table").Eq(0).Find("caption").AttrOr("id", "")
// vList := strings.Split(vInfo, "-sdk-")
// vStr := vList[len(vList)-1]
// // //div[@class="download-panel"]//div//table[1]
// d.doc.Find("div.download-panel").Find("div").Find("table").Eq(0).Find("a").Each(func(_ int, s *goquery.Selection) {
// uu := s.AttrOr("href", "")
// if filterDotNetSDKByUrl(uu) {
// if !strings.Contains(uu, d.host) {
// uu, _ = url.JoinPath(d.host, uu)
// }
// d.fetchVersion(uu, vStr)
// }
// })
}
}

Expand Down

0 comments on commit 7fb753a

Please sign in to comment.