mediapart remove filter by date to get 10 last articles

This commit is contained in:
quenousimporte 2024-05-24 15:01:56 +02:00
parent a5b4b1e735
commit a7d045b484
2 changed files with 47 additions and 49 deletions

View File

@ -17,7 +17,7 @@
<h2>Quotidiens</h2>
<p>
<a href="https://mediapart.fr">Mediapart</a>
- <a href="./mediapart.php">Edition du jour en version texte</a><br>
- <a href="./mediapart.php">10 derniers articles en version texte</a><br>
<a href="https://lesjours.fr">Les jours</a><br>
<a href="https://reporterre.net/">Reporterre</a><br>
<a href="https://basta.media">Basta!</a><br>

View File

@ -22,8 +22,6 @@ $header = "Mediapart - " . $localedate . "\n\nSommaire:\n";
$result = '';
foreach ($items as $item)
{
if (str_starts_with($item->pubDate, date("D, j M Y")))
{
$title = $item->title;
//$category = $item->category;
@ -64,6 +62,7 @@ foreach ($items as $item)
// Output
$result .= "\n------\n\n";
$result .= "Article : " . $item->title . "\n";
$result .= "Date : " . $item->pubDate . "\n";
$result .= 'Catégorie : ' . str_replace("\n", '', $category) . "\n";
$result .= 'Auteur.ice : ' . $author . "\n";
$result .= "Introduction : " . $summary . "\n";
@ -73,7 +72,6 @@ foreach ($items as $item)
$maintext = $finder->query('//div[contains(@class, "paywall-restricted-content")]');
$result .= $maintext->item(0)->textContent;
}
}
$filename = 'mediapart' . str_replace(' ', '', $localedate) . '.txt';