simplify mp home xpath, more inclusive

This commit is contained in:
quenousimporte 2024-08-23 09:31:16 +02:00
parent 5fdfa0fff1
commit 21daa9e426
1 changed files with 2 additions and 9 deletions

View File

@ -408,13 +408,9 @@
$doc->loadHTML($home); $doc->loadHTML($home);
$finder = new DomXPath($doc); $finder = new DomXPath($doc);
$coldcondition = '[contains(@class, "_hot")]'; $xpath = '//a[@data-js = "teaser-link" and contains(@href, "/journal/") and not(contains(@href, "/dossier/")) and not(contains(@href, "/studio/")) and not(contains(@href, "fil-")) and (@href != "/journal/series")]/@href';
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'); $links = $finder->query($xpath);
foreach ($links as $link) foreach ($links as $link)
{ {
@ -662,9 +658,6 @@
<input id="mphome" name="mphome" type="checkbox"> <input id="mphome" name="mphome" type="checkbox">
<label for="mphome">From home page</label> <label for="mphome">From home page</label>
<br> <br>
<input id="mpcold" name="mpcold" type="checkbox">
<label for="mpcold">Include cold articles</label>
<br>
<input id="forcempcookies" name="forcempcookies" type="checkbox"> <input id="forcempcookies" name="forcempcookies" type="checkbox">
<label for="forcempcookies">Force cookies</label> <label for="forcempcookies">Force cookies</label>