chore(clean) remove obsolete code
This commit is contained in:
parent
7597984c04
commit
9b94adb640
@ -1,47 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Agrégateur Parents</title>
|
||||
<style>
|
||||
.film { border:1px solid #ccc; margin:10px; padding:10px; }
|
||||
.film img { max-height: 180px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="films"></div>
|
||||
<script>
|
||||
// Appelle ton backend qui utilise le module JS au-dessus
|
||||
// Ici, on simule avec des données
|
||||
const films = [
|
||||
{
|
||||
title: "A Minecraft Movie",
|
||||
year: "2025",
|
||||
imgSrc: "https://www.cinecheck.be/media/n1hojmmh/a-minecraft-movie-ov-_ps_1_jpg_sd-high_2025-warner-bros-entertainment-inc-all-rights-reserved-photo-credit-courtesy-warner-bros-pictures.jpg",
|
||||
link: "https://www.cinecheck.be/films/a-minecraft-movie/",
|
||||
marks: ["9 ans", "Peur"],
|
||||
summary: "A Minecraft Movie, van Warner Bros. Pictures en Legendary Pictures, ...",
|
||||
details: [
|
||||
{ type: "angst", description: "La film contient des scènes effrayantes..." }
|
||||
]
|
||||
}
|
||||
];
|
||||
const container = document.getElementById('films');
|
||||
films.forEach(f => {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'film';
|
||||
div.innerHTML = `
|
||||
<h2>${f.title} (${f.year || "?"})</h2>
|
||||
<img src="${f.imgSrc}" alt="cover">
|
||||
<div><b>Conseil d'âge:</b> ${f.marks.join(', ')}</div>
|
||||
<p>${f.summary}</p>
|
||||
<ul>
|
||||
${f.details.map(d => `<li><b>${d.type}:</b> ${d.description}</li>`).join('')}
|
||||
</ul>
|
||||
<a href="${f.link}" target="_blank">Voir sur Cinecheck</a>
|
||||
`;
|
||||
container.appendChild(div);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -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 };
|
Loading…
x
Reference in New Issue
Block a user