| 
				
					
						
							 | 
			||
|---|---|---|
| src | ||
| tests | ||
| .eslintrc.js | ||
| .gitignore | ||
| .travis.yml | ||
| README.md | ||
| babel.config.js | ||
| package-lock.json | ||
| package.json | ||
		
			
				
				README.md
			
		
		
			
			
		
	
	EPG Grabber 
Node.js CLI tool for grabbing EPG from different websites.
Installation
npm install -g epg-grabber
Usage
epg-grabber --config=example.com.config.js
Arguments:
-c, --config: path to config file-d, --debug: enable debug mode
example.com.config.js
module.exports = {
  lang: 'fr', // default language for all programs (default: 'en')
  site: 'example.com', // site domain name (required)
  output: 'example.com.guide.xml', // path to output file (default: 'guide.xml')
  channels: 'example.com.channels.xml', // path to channels.xml file (required)
  /**
   * @param {object} date The 'dayjs' instance with the requested date
   * @param {object} channel Data about the requested channel
   *
   * @return {string} The function should return URL of the program page for the channel
   */
  url: function ({ date, channel }) {
    return `https://example.com/${date.format('YYYY-MM-DD')}/channel/${channel.site_id}.html`
  },
  /**
   * @param {object} channel Data about the requested channel
   * @param {string} content The response received after the request at the above url
   *
   * @return {string} The function should return URL of the channel logo (optional)
   */
  logo: function ({ channel, content }) {
    return `https://example.com/logos/${channel.site_id}.png`
  },
  /**
   * @param {string} content The response received after the request at the above url
   *
   * @return {array} The function should return an array of programs with their descriptions
   */
  parser: function ({ content }) {
    // content parsing...
    return [
      {
        title, // program title (required)
        start, // program start time (required)
        stop, // program end time (optional)
        description, // program description (optional)
        category, // program category (optional)
        lang // program language (default: 'en')
      },
      ...
    ]
  }
}
example.com.channels.xml
<?xml version="1.0"?>
<site site="example.com">
  <channels>
    <channel site_id="cnn-23" xmltv_id="CNN.us">CNN</channel>
    ...
  </channels>
</site>
You can also specify the language and logo for each channel individually, like so:
<channel site_id="france-24" xmltv_id="France24.fr" lang="fr" logo="https://example.com/france24.png">France 24</channel>
Contribution
If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.