add option to include mp cold articles from home

fix article date
This commit is contained in:
quenousimporte 2024-08-22 14:23:30 +02:00
parent 566287d767
commit 5fdfa0fff1
1 changed files with 11 additions and 2 deletions

View File

@ -408,7 +408,13 @@
$doc->loadHTML($home);
$finder = new DomXPath($doc);
$links = $finder->query('//section[contains(@class, "_hot")]//a[not(contains(@href, "/dossier/")) and not(contains(@href, "/studio/")) and not(contains(@href, "fil-")) and (@href != "/journal/series")]/@href');
$coldcondition = '[contains(@class, "_hot")]';
if (isset($_POST['mpcold']) && $_POST['mpcold'])
{
$coldcondition = '[contains(@class, "_cold") or contains(@class, "_hot")]';
}
$links = $finder->query('//section' . $coldcondition . '//a[not(contains(@href, "/dossier/")) and not(contains(@href, "/studio/")) and not(contains(@href, "fil-")) and (@href != "/journal/series")]/@href');
foreach ($links as $link)
{
@ -421,7 +427,7 @@
$title = $finder->query('//h1')->item(0)->textContent;
$author = $finder->query('//a[contains(@href, "biographie")]')->item(0)->textContent;
$date = $finder->query('//time')->item(0)->textContent;
$date = $finder->query('//time')->item(1)->textContent;
$summary = $finder->query('//p[contains(@class, "news__heading__top__intro")]')->item(0)->textContent;
// strip images
@ -656,6 +662,9 @@
<input id="mphome" name="mphome" type="checkbox">
<label for="mphome">From home page</label>
<br>
<input id="mpcold" name="mpcold" type="checkbox">
<label for="mpcold">Include cold articles</label>
<br>
<input id="forcempcookies" name="forcempcookies" type="checkbox">
<label for="forcempcookies">Force cookies</label>