added firstSeen to job struct

This commit is contained in:
ChrQR 2024-06-11 08:49:46 +02:00
parent 8abff30b52
commit 979ed97738

View File

@ -6,6 +6,7 @@ import (
"log" "log"
"os" "os"
"strings" "strings"
"time"
"github.com/gocolly/colly" "github.com/gocolly/colly"
) )
@ -19,6 +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"`
} }
type skills struct { type skills struct {
@ -62,7 +64,7 @@ var (
excluded = []string{"senior", "lead", "founder", "cto", "vp of"} excluded = []string{"senior", "lead", "founder", "cto", "vp of"}
) )
func scrapeJobs() { func scrapeHub() {
file, err := os.Create(fName) file, err := os.Create(fName)
if err != nil { if err != nil {
@ -129,6 +131,7 @@ func scrapeJobs() {
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(),
} }
jobs = append(jobs, jobDetails) jobs = append(jobs, jobDetails)
jobCount++ jobCount++
@ -152,6 +155,8 @@ func scrapeJobs() {
} }
func main() { func main() {
scrapeJobs() scrapeHub()
} }