Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Scaladex web-scrapping for projects list #354

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions coordinator/configs/projects-config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ geirolz_secret.source-version=3.4 // implicts
gemini-hlsw_gsp-graphql.tests = compile-only // uses Docker
gemini-hlsw_lucuma-itc.java.version = 17
getkyo_kyo {
java.version = 21
source-version = 3.4
}
guntiso_mojoz.java.version = 8
Expand Down
6 changes: 3 additions & 3 deletions coordinator/src/main/scala/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//> using dep "org.jsoup:jsoup:1.17.2"
//> using dep "org.json4s::json4s-native:4.0.7"
//> using dep "org.json4s::json4s-ext:4.0.7"
//> using dep "com.github.pureconfig::pureconfig-core:0.17.6"
//> using dep "com.lihaoyi::os-lib:0.9.3"
//> using dep "com.lihaoyi::requests:0.8.0"
//> using dep "com.github.pureconfig::pureconfig-core:0.17.7"
//> using dep "com.lihaoyi::os-lib:0.10.2"
//> using dep "com.lihaoyi::requests:0.8.3"

//> using resourceDir "../resources"
16 changes: 10 additions & 6 deletions coordinator/src/main/scala/deps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ def loadProjects(scalaBinaryVersion: String): Seq[StarredProject] =
)
.get()
d.select(".list-result .row").asScala.flatMap { e =>
val texts = e.select("h4").get(0).text().split("/")
val stars = e.select(".stats [title=Stars]").asScala.map(_.text)
Option.unless(texts.isEmpty || stars.isEmpty) {
StarredProject(texts.head, texts.drop(1).mkString("/"))(
stars.head.toInt
)
e.select("h4").get(0).text().takeWhile(!_.isWhitespace) match {
case s"${organization}/${repository}" =>
for
ghStars <- e.select(".stats [title=Stars]")
.asScala
.headOption
.flatMap(_.text.toIntOption)
yield
StarredProject(organization, repository)(ghStars)
case _ => None
}
}
LazyList
Expand Down