added firstSeen to job struct
This commit is contained in:
		
							parent
							
								
									8abff30b52
								
							
						
					
					
						commit
						979ed97738
					
				
							
								
								
									
										9
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.go
									
									
									
									
									
								
							@ -6,6 +6,7 @@ import (
 | 
			
		||||
	"log"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/gocolly/colly"
 | 
			
		||||
)
 | 
			
		||||
@ -19,6 +20,7 @@ type job struct {
 | 
			
		||||
	Description string `json:"description"`
 | 
			
		||||
	Link        string `json:"link"`
 | 
			
		||||
	Skills      skills `json:"skills"`
 | 
			
		||||
	FirstSeen  	time.Time `json:"firstSeen"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type skills struct {
 | 
			
		||||
@ -62,7 +64,7 @@ var (
 | 
			
		||||
	excluded        = []string{"senior", "lead", "founder", "cto", "vp of"}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func scrapeJobs() {
 | 
			
		||||
func scrapeHub() {
 | 
			
		||||
 | 
			
		||||
	file, err := os.Create(fName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@ -129,6 +131,7 @@ func scrapeJobs() {
 | 
			
		||||
			Description: descriptionHTML,
 | 
			
		||||
			Link:        e.Request.URL.String(),
 | 
			
		||||
			Skills:      skillChecker(e.ChildText("content.text-block__content > span")),
 | 
			
		||||
			FirstSeen:   time.Now(),
 | 
			
		||||
		}
 | 
			
		||||
		jobs = append(jobs, jobDetails)
 | 
			
		||||
		jobCount++
 | 
			
		||||
@ -152,6 +155,8 @@ func scrapeJobs() {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	scrapeJobs()
 | 
			
		||||
	scrapeHub()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user