Compare commits

..

No commits in common. "ee0f2fe47c3b0b301cef31ba2282a303cefc2027" and "d951c87d729da18730b361173b25fda59ab330b7" have entirely different histories.

1 changed files with 9 additions and 16 deletions

View File

@ -14,7 +14,6 @@
function get_clean_html($node)
{
// todo check words with "-" (like "sous-traitance")
$innerHTM = '';
foreach ($node->childNodes as $childNode){
$nodeHTML = $childNode->ownerDocument->saveHTML($childNode);
@ -75,7 +74,6 @@
// articles accès libre
$nodes = $finder->query('//div[contains(@class, "news__body__center__article")]');
}
// todo add "boite noire"
if (!$nodes->length)
{
@ -207,8 +205,8 @@
$epub = new TPEpubCreator();
$epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/' . $pubname . 'cafeyn.epub';
$epub->title = $pubname . ' Cafeyn - ' . $today ;
$epub->epub_file = 'epub/' . $pubname . '.epub';
$epub->title = $pubname . ' ' . $today ;
$list = (array)$publication->articles;
$page = 1;
@ -396,7 +394,7 @@
$xml = new SimpleXMLElement($feed);
$items = $xml->xpath("/rss/channel/item");
foreach (array_reverse($items) as $item)
foreach ($items as $item)
{
add_mp_article($item->link, $context, $epub);
}
@ -412,29 +410,24 @@
$opts = [
'http' => [
'method' => "GET",
//'header' => "Accept-language: en\nCookie: MPSESSID=" . $mp_sessionid, // todo?
//'header' => "Accept-language: en\nCookie: MPSESSID=" . $mp_sessionid, // todo
]
];
$context = stream_context_create($opts);
// todo add cover!
$epub = new TPEpubCreator();
$epub->temp_folder = 'temp/';
$epub->epub_file = 'epub/politis' . $issuenb . '.epub';
$epub->title = 'Politis ' . $issuenb . ' - RSS ' . $today;
// find cover
$issues = file_get_contents('https://www.politis.fr/boutique/magazines-unite/');
$doc = new DOMDocument();
$doc->loadHTML($issues);
$finder = new DomXPath($doc);
$cover = $finder->query('//img[contains(@src, "' . $issuenb . '_")]')->item(0)->getAttribute('src');
$epub->AddImage($cover, 'image/jpeg', true);
// load feeds
$feed = file_get_contents($feedurl);
$xml = new SimpleXMLElement($feed);
$items = $xml->xpath("/rss/channel/item");
// reverse to respect timing
foreach (array_reverse($items) as $item)
{
$url = $item->link;
@ -504,7 +497,7 @@
write_epub($epub);
}
// New York Times RSS
// New York Times
if (isset($_POST['nyt']) && $_POST['nyt'])
{
$feedurl = 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml';
@ -526,7 +519,7 @@
$xml = new SimpleXMLElement($feed);
$items = $xml->xpath("/rss/channel/item");
foreach (array_reverse($items) as $item)
foreach ($items as $item)
{
$title = $item->title;
$author = $item->xpath('dc:creator')[0];