spinlud / linkedin-jobs-scraper

147 stars 40 forks source link

return filters with events.scraper.data #41

Open HamedOsama opened 1 year ago

HamedOsama commented 1 year ago

If I run multiple scrappers with different filters and push it all in array like this:

scraper.on(events.scraper.data, (data) => {
    jobs.push({
      id: data.jobId,
      title: data.title,
      company: data.company,
      link: data.applyLink ? data.applyLink : data.link,
      logo: data.companyImgLink || '',
      deadline: data.date,
      skills: '',
      experience: '',
    });

In this case I can't access the experience which is filter I had already set but it does not exist on type 'IData'

const scrappers = queryArr.map((q) => {
    return [
      {
        query: q,
        options: {
          ...options,
          filters: {
            ...filters,
            experience: [experienceLevelFilter.INTERNSHIP],
          }
        }
      },
      {
        query: q,
        options: {
          ...options,
          filters: {
            ...filters,
            experience: [experienceLevelFilter.ENTRY_LEVEL],
          }
        }
      }
    ]
  })

IData type

  export interface IData {
    query: string;
    location: string;
    jobId: string;
    jobIndex: number; // Job index during search, only useful for debug
    link: string;
    applyLink?: string;
    title: string;
    company: string;
    companyLink?: string;
    companyImgLink?: string;
    place: string;
    date: string;
    description: string;
    descriptionHTML: string;
    insights: string[];
}