<commit_before>﻿module.exports = function () {
    var parseXMLString = require('xml2js').parseString,
        apiConstants = require('../../common/api-constants.js')(),
        httpService = require('../../common/http-service.js')();

    return {
        get: function () {
            console.log(apiConstants.bbc);
            var options = httpService.clone(apiConstants.bbc);
            return httpService.performGetRequest(options, dataTransformer);

            function dataTransformer(data) {
                var articlesArray = [];
                parseXMLString(data, function (err, result) {
                    parseXMLString(data, function (err, result) {
                        result.rss.channel[0].item.forEach(function (newsItemData) {
                            articlesArray.push({
                                title: newsItemData.title[0],
                                shortInfo: newsItemData.description ? newsItemData.description[0] : '',
                                url: newsItemData.link[0],
                                image: null,//newsItemData['media:thumbnail'][0]['$'].url
                                dateTime: newsItemData.pubDate ? newsItemData.pubDate[0] : ''
                            });
                        });
                    });
                });
                return articlesArray;
            }
        }
    };
};<commit_msg>Added a provider for the bbc news<commit_after>﻿module.exports = function () {
    var parseXMLString = require('xml2js').parseString,
        apiConstants = require('../../common/api-constants.js')(),
        httpService = require('../../common/http-service.js')();

    return {
        get: function () {
            console.log(apiConstants.bbc);
            var options = httpService.clone(apiConstants.bbc);
            return httpService.performGetRequest(options, dataTransformer);

            function dataTransformer(data) {
                var articlesArray = [];
                parseXMLString(data, function (err, result) {
                    parseXMLString(data, function (err, result) {
                        result.rss.channel[0].item.forEach(function (newsItemData) {
                            articlesArray.push({
                                title: newsItemData.title[0],
                                shortInfo: newsItemData.description ? newsItemData.description[0] : '',
                                url: newsItemData.link[0],
                                image: null,//newsItemData['media:thumbnail'][0]['$'].url
                                dateTime: newsItemData.pubDate ? newsItemData.pubDate[0] : '',
                                provider: 'bbc'
                            });
                        });
                    });
                });
                return articlesArray;
            }
        }
    };
};
{'fraction_non_alphanumeric': 0.11834319526627218, 'fraction_numerical': 0.004872955099199443, 'mean_word_length': 1.3538083538083538, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3074772', 'n_tokens_mistral': 690, 'n_tokens_neox': 664, 'n_words': 104}