todos and comments
This commit is contained in:
		
							parent
							
								
									d951c87d72
								
							
						
					
					
						commit
						4b2424ae17
					
				
							
								
								
									
										9
									
								
								epub.php
								
								
								
								
							
							
						
						
									
										9
									
								
								epub.php
								
								
								
								
							| 
						 | 
					@ -14,6 +14,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function get_clean_html($node)
 | 
						function get_clean_html($node)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							// todo check words with "-" (like "sous-traitance")
 | 
				
			||||||
		$innerHTM = '';
 | 
							$innerHTM = '';
 | 
				
			||||||
		foreach ($node->childNodes as $childNode){
 | 
							foreach ($node->childNodes as $childNode){
 | 
				
			||||||
			$nodeHTML = $childNode->ownerDocument->saveHTML($childNode);
 | 
								$nodeHTML = $childNode->ownerDocument->saveHTML($childNode);
 | 
				
			||||||
| 
						 | 
					@ -74,6 +75,7 @@
 | 
				
			||||||
			// articles accès libre
 | 
								// articles accès libre
 | 
				
			||||||
			$nodes = $finder->query('//div[contains(@class, "news__body__center__article")]');
 | 
								$nodes = $finder->query('//div[contains(@class, "news__body__center__article")]');
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							// todo add "boite noire"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!$nodes->length)
 | 
							if (!$nodes->length)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -410,13 +412,11 @@
 | 
				
			||||||
		$opts = [
 | 
							$opts = [
 | 
				
			||||||
		'http' => [
 | 
							'http' => [
 | 
				
			||||||
			'method' => "GET",
 | 
								'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);
 | 
							$context = stream_context_create($opts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// todo add cover!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$epub = new TPEpubCreator();
 | 
							$epub = new TPEpubCreator();
 | 
				
			||||||
		$epub->temp_folder = 'temp/';
 | 
							$epub->temp_folder = 'temp/';
 | 
				
			||||||
		$epub->epub_file = 'epub/politis' . $issuenb . '.epub';
 | 
							$epub->epub_file = 'epub/politis' . $issuenb . '.epub';
 | 
				
			||||||
| 
						 | 
					@ -427,7 +427,6 @@
 | 
				
			||||||
		$xml = new SimpleXMLElement($feed);
 | 
							$xml = new SimpleXMLElement($feed);
 | 
				
			||||||
		$items = $xml->xpath("/rss/channel/item");
 | 
							$items = $xml->xpath("/rss/channel/item");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// reverse to respect timing
 | 
					 | 
				
			||||||
		foreach (array_reverse($items) as $item)
 | 
							foreach (array_reverse($items) as $item)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			$url = $item->link;
 | 
								$url = $item->link;
 | 
				
			||||||
| 
						 | 
					@ -497,7 +496,7 @@
 | 
				
			||||||
		write_epub($epub);
 | 
							write_epub($epub);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// New York Times
 | 
						// New York Times RSS
 | 
				
			||||||
	if (isset($_POST['nyt']) && $_POST['nyt'])
 | 
						if (isset($_POST['nyt']) && $_POST['nyt'])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		$feedurl = 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml';
 | 
							$feedurl = 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml';
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue