This commit is contained in:
quenousimporte 2024-08-29 14:44:35 +02:00
parent c6f604c28b
commit 2a0274068a
1 changed files with 7 additions and 17 deletions

View File

@ -150,16 +150,6 @@
return $temp_img_path; return $temp_img_path;
} }
function inner_html($node)
{
$innerHTML = '';
foreach ($node->childNodes as $childNode)
{
$innerHTML .= $childNode->ownerDocument->saveHTML($childNode);
}
return $innerHTML;
}
function get_json($url) function get_json($url)
{ {
// cache json in case url expires // cache json in case url expires
@ -178,7 +168,7 @@
} }
date_default_timezone_set('Europe/Paris'); date_default_timezone_set('Europe/Paris');
$date = (new DateTime('today'))->format('Ymd'); $today = (new DateTime('today'))->format('Ymd');
if (isset($_POST['emptycache']) && $_POST['emptycache']) if (isset($_POST['emptycache']) && $_POST['emptycache'])
{ {
@ -211,7 +201,7 @@
$epub = new TPEpubCreator(); $epub = new TPEpubCreator();
$epub->temp_folder = 'temp/'; $epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/' . $pubname . '.epub'; $epub->epub_file = 'epub/' . $pubname . '.epub';
$epub->title = $pubname . ' ' . $date ; $epub->title = $pubname . ' ' . $today ;
$list = (array)$publication->articles; $list = (array)$publication->articles;
$page = 1; $page = 1;
@ -296,7 +286,7 @@
$epub = new TPEpubCreator(); $epub = new TPEpubCreator();
$epub->temp_folder = 'temp/'; $epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/lemonde.epub'; $epub->epub_file = 'epub/lemonde.epub';
$epub->title = 'Le Monde ' . $date ; $epub->title = 'Le Monde ' . $today;
$publication = get_json($url); $publication = get_json($url);
$content = array_filter($publication->Content, function($item) { return $item->Category == 'Le Monde'; }); $content = array_filter($publication->Content, function($item) { return $item->Category == 'Le Monde'; });
@ -382,7 +372,7 @@
$epub = new TPEpubCreator(); $epub = new TPEpubCreator();
$epub->temp_folder = 'temp/'; $epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/mediapart.epub'; $epub->epub_file = 'epub/mediapart.epub';
$epub->title = 'Mediapart - RSS ' . $date; $epub->title = 'Mediapart - RSS ' . $today;
// load feeds // load feeds
$feed = file_get_contents($feedurl); $feed = file_get_contents($feedurl);
@ -412,7 +402,7 @@
$epub = new TPEpubCreator(); $epub = new TPEpubCreator();
$epub->temp_folder = 'temp/'; $epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/mediaparthome.epub'; $epub->epub_file = 'epub/mediaparthome.epub';
$epub->title = 'Mediapart - A la une ' . $date; $epub->title = 'Mediapart - A la une ' . $today;
$home = file_get_contents($homeurl, false, $context); $home = file_get_contents($homeurl, false, $context);
$doc = new DOMDocument(); $doc = new DOMDocument();
@ -446,7 +436,7 @@
$epub = new TPEpubCreator(); $epub = new TPEpubCreator();
$epub->temp_folder = 'temp/'; $epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/newyorktimes.epub'; $epub->epub_file = 'epub/newyorktimes.epub';
$epub->title = 'The New York Times ' . $date; $epub->title = 'The New York Times ' . $today;
// load feeds // load feeds
$feed = file_get_contents($feedurl); $feed = file_get_contents($feedurl);
@ -502,7 +492,7 @@
$epub = new TPEpubCreator(); $epub = new TPEpubCreator();
$epub->temp_folder = 'temp/'; $epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/newyorktimestoday.epub'; $epub->epub_file = 'epub/newyorktimestoday.epub';
$epub->title = 'The New York Times today\'s paper ' . $date; $epub->title = 'The New York Times today\'s paper ' . $today;
// grab today's paper // grab today's paper
$start = strpos($todaypage, "window.__preloadedData = ") + 25; $start = strpos($todaypage, "window.__preloadedData = ") + 25;