@irsooti/football-data-scraper
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published

    Football data scraper

    A scraper for http://www.football-data.co.uk/

    npm (scoped)

    🤷‍♂️ What this library can do for you?

    It can scrapes this football site and save for you the csv inside of it. I made some facilities in order to get the csv for specific season and for some specific league!

    See the examples below:

    import {
      scrapeBySeasonAndDownload,
      models
    } from '@irsooti/football-data-scraper';
    
    async function yourFunc() {
      const data = await scrapeBySeasonAndDownload(2019, 2020, models.ITALY);
      console.log(data);
      //   { data:
      //        [ { id: 'I1',
      //            leagueName: 'Serie A',
      //            url:
      //             '/<local-path>/Projects/football-data-scraper/csv/1920/I1.csv' },
      //          { id: 'I2',
      //            leagueName: 'Serie B',
      //            url:
      //             '/<local-path>/Projects/football-data-scraper/csv/1920/I2.csv' } ],
      //       error: undefined 
      //    }
    }

    Otherwise, if you want just only the link to download the file:

    import {
      scrapeBySeason,
      models
    } from '@irsooti/football-data-scraper';
    
    async function yourFunc() {
      const data = await scrapeBySeason(2019, 2020, models.ITALY);
      console.log(data);
      // It returns:
    
      // [{
      //   url: 'https://www.football-data.co.uk/mmz4281/1920/I1.csv',
      //   leagueName: 'Serie A',
      //   id: 'I1'
      // },
      // {
      //   url: 'https://www.football-data.co.uk/mmz4281/1920/I2.csv',
      //   leagueName: 'Serie B',
      //   id: 'I2'
      // }];
    }

    Or if you want the data already json parsed:

    import {
      getBySeason,
      models
    } from '@irsooti/football-data-scraper';
    
    async function yourFunc() {
      const data = await getBySeason(2019, 2020, models.ITALY);
      console.log(data);
      // It returns:
    
        // [ { getContent: [Function: getContent] <-- Promise,
        //     id: 'I1',
        //     leagueName: 'Serie A' },
        //   { getContent: [Function: getContent],
        //     id: 'I2',
        //     leagueName: 'Serie B' } ]
    
    }

    Hope you enjoy it!

    Buy Me A Coffee

    Install

    npm i @irsooti/football-data-scraper

    DownloadsWeekly Downloads

    11

    Version

    1.1.1

    License

    ISC

    Unpacked Size

    17.4 kB

    Total Files

    19

    Last publish

    Collaborators

    • irsooti