I'm currently tring to exploit a RSS feed to get latest articles from a website.
What I'm doing is to store these data in a MySQL DB. I do that with Javascript, to take informations from the RSS feed.
When I host the script on my server, it's not working anymore.
For the context of programming, on local, I used XAMPP, with a localhost. Then, I do a parcel build, the script being attached to a HTML page, so that I can call it just by loading the WebPage.
I got the error from the title :

Here is the code :
let Parser = require('rss-parser');
let parser = new Parser();
(async () => {
// Connecting to database
const mysql = require('mysql');
const connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'dataarticles'
});
connection.connect((err) => {
if (err) throw err;
console.log('Connected!');
});
let feed = await parser.parseURL('http://feedrinse.com/services/rinse/?rinsedurl=235e4f5244e1eeb21ce05fc3d4d68cc0');
//== Some console.log to check
// console.log(feed.items[0]['content:encoded']);
//== Some console.log to check
// console.log(feed.items[0].title + "\n"
// + feed.items[0].link + "\n"
// + feed.items[0].contentSnippet + "\n"
// + feed.items[0].pubDate);
// As the feed doesn't provide the minia of article, I take the first image in the content of the test, by searching it
let firstPos = feed.items[0]['content:encoded'].search("https://droidsoft.fr/wp-content/uploads/");
let SecondPos = feed.items[0]['content:encoded'].search('alt="');
let image = feed.items[0]['content:encoded'].substring(firstPos, SecondPos - 2);
let pubDate = feed.items[0].pubDate.substring(5, 16);
//== Some console.log to check
// console.log(image);
// console.log(pubDate);
// We take first item (items[0]) as it's the latest feed. This script is triggered only when there is a new element, so there shouldn't be
// any problem of duplication
connection.query('INSERT INTO `dataarticles` (`Titre`, `URL`, `Description`, `Image`, `date`) VALUES ("' + feed.items[0].title + '", "' + feed.items[0].link + '", "' + feed.items[0].contentSnippet + '", "' + image + '", "' + pubDate + '")', (err, rows) => {
// if (err) throw err;
console.log(rows);
});
})();