finished implementation of itjobbank

This commit is contained in:
ChrQR 2024-06-11 12:08:58 +02:00
parent 32f83e358b
commit 8c9f6e2dee

10
main.go
View File

@ -20,7 +20,7 @@ type job struct {
Description string `json:"description"` Description string `json:"description"`
Link string `json:"link"` Link string `json:"link"`
Skills skills `json:"skills"` Skills skills `json:"skills"`
FirstSeen time.Time `json:"firstSeen"` Scraped string `json:"scraped"`
Source string `json:"source"` Source string `json:"source"`
} }
@ -80,7 +80,7 @@ func checkIfStudent(description string) string {
// Slice to store job details // Slice to store job details
var ( var (
excluded = []string{"senior", "lead", "founder", "cto", "vp of", "erfaren", "arkitekt", "architect", "manager", "ulønnet", "unpaid", "praktik"} excluded = []string{"senior", "lead", "founder", "cto", "vp of", "erfaren", "arkitekt", "architect", "manager", "ulønnet", "unpaid", "praktik", "cyber", "leder", "sikkerhed", "supporter"}
unpaidKeywords = []string{"unpaid", "praktik", "ulønnet"} unpaidKeywords = []string{"unpaid", "praktik", "ulønnet"}
studentKeywords = []string{"studerende", "studenter", "student", "medhjælper"} studentKeywords = []string{"studerende", "studenter", "student", "medhjælper"}
) )
@ -162,7 +162,7 @@ func scrapeHub() {
Description: descriptionHTML, Description: descriptionHTML,
Link: e.Request.URL.String(), Link: e.Request.URL.String(),
Skills: skillChecker(e.ChildText("content.text-block__content > span")), Skills: skillChecker(e.ChildText("content.text-block__content > span")),
FirstSeen: time.Now(), Scraped: time.Now().String(),
Source: baseUrl, Source: baseUrl,
} }
jobs = append(jobs, jobDetails) jobs = append(jobs, jobDetails)
@ -194,7 +194,7 @@ func scrapeItJobBank() {
fName = "it-jobbank.json" fName = "it-jobbank.json"
maxJobs = 30 maxJobs = 30
baseUrl = "https://www.it-jobbank.dk" baseUrl = "https://www.it-jobbank.dk"
searchString = "https://www.it-jobbank.dk/jobsoegning" searchString = "https://www.it-jobbank.dk/jobsoegning/udvikling"
file, err = os.Create(fName) file, err = os.Create(fName)
) )
if err != nil { if err != nil {
@ -257,7 +257,7 @@ func scrapeItJobBank() {
Description: descriptionHTML, Description: descriptionHTML,
Link: e.Request.URL.String(), Link: e.Request.URL.String(),
Skills: skillChecker(descriptionHTML), Skills: skillChecker(descriptionHTML),
FirstSeen: time.Now(), Scraped: time.Now().String(),
Source: baseUrl, Source: baseUrl,
} }
jobs = append(jobs, jobDetails) jobs = append(jobs, jobDetails)