From 9b94adb64009f18810f1ebdcd2216dde6e639213 Mon Sep 17 00:00:00 2001 From: Morgan Wattiez Date: Sun, 18 May 2025 21:02:44 +0200 Subject: [PATCH] chore(clean) remove obsolete code --- aggregateur-sample.html | 47 -------------------------- cinecheck-adapter.js | 75 ----------------------------------------- 2 files changed, 122 deletions(-) delete mode 100644 aggregateur-sample.html delete mode 100644 cinecheck-adapter.js diff --git a/aggregateur-sample.html b/aggregateur-sample.html deleted file mode 100644 index b8e5270..0000000 --- a/aggregateur-sample.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - Agrégateur Parents - - - -
- - - diff --git a/cinecheck-adapter.js b/cinecheck-adapter.js deleted file mode 100644 index d76f5a7..0000000 --- a/cinecheck-adapter.js +++ /dev/null @@ -1,75 +0,0 @@ -const axios = require('axios'); -const cheerio = require('cheerio'); - -const CINECHECK_BASE = 'https://www.cinecheck.be'; - -async function searchMovies(query) { - const url = `${CINECHECK_BASE}/umbraco/surface/searchresults/search?query=${encodeURIComponent(query)}&producties=0&amount=5`; - const res = await axios.get(url, { - headers: { - 'x-umb-culture': 'fr-BE', - 'x-umb-key': '0a0c11a9-ece8-4dc8-8578-e5aab235d9ff', - 'x-requested-with': 'XMLHttpRequest', - 'User-Agent': 'Mozilla/5.0', - } - }); - const $ = cheerio.load(res.data); - const results = []; - $('.c-search__result').each((_, el) => { - const title = $(el).find('.c-search__title').text().trim().replace(/\s*\(.+?\)\s*$/, ''); - const yearMatch = $(el).find('.c-search__title').text().match(/\((\d{4})\)/); - const year = yearMatch ? yearMatch[1] : null; - const imgSrc = $(el).find('img.c-search__image').attr('src') - ? CINECHECK_BASE + $(el).find('img.c-search__image').attr('src') - : null; - const link = $(el).find('a.c-search__hiddenlink').attr('href') - ? CINECHECK_BASE + $(el).find('a.c-search__hiddenlink').attr('href') - : null; - if (title && link) { - results.push({ title, year, imgSrc, link }); - } - }); - return results; -} - -async function getMovieClassification(movieUrl) { - const res = await axios.get(movieUrl, { - headers: { 'User-Agent': 'Mozilla/5.0' } - }); - const $ = cheerio.load(res.data); - - const year = $('.c-movie__details .c-movie__label').first().text().trim() || null; - const genres = $('.c-movie__details .c-movie__label').eq(1).text().split(',').map(s => s.trim()); - const img = $('.c-movie__cover img').attr('src') - ? CINECHECK_BASE + $('.c-movie__cover img').attr('src') - : null; - - const marks = []; - $('.c-header__marks .c-header__mark').each((_, el) => { - const label = $(el).find('span.vh').text().trim(); - if (label) marks.push(label); - }); - - const details = []; - $('.c-classificatie__item').each((_, el) => { - const type = $(el).find('svg use').first().attr('xlink:href') || ''; - const typeName = type.split('#')[1] || ''; - const description = $(el).find('.js-classificatie-text').text().trim(); - if (typeName && description) { - details.push({ type: typeName, description }); - } - }); - - const summary = $('.c-movie__introtext p').first().text().trim(); - - return { - year, - genres, - img, - marks, - details, - summary - }; -} - -module.exports = { searchMovies, getMovieClassification };