prepare mp refactor home and rss
This commit is contained in:
parent
cb59059a2b
commit
b97f730205
22
epub.php
22
epub.php
|
@ -17,6 +17,11 @@
|
|||
require 'settings.php';
|
||||
require 'TPEpubCreator.php';
|
||||
|
||||
function add_mp_article($url, $context, $epub)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function get_mp_cookie()
|
||||
{
|
||||
global $mp_user;
|
||||
|
@ -325,17 +330,18 @@
|
|||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$title = $item->title;
|
||||
$url = $item->link;
|
||||
|
||||
$category = $item->xpath('dc:subject')[0];
|
||||
$author = $item->xpath('dc:creator')[0];
|
||||
$summary = $item->description;
|
||||
|
||||
$article = file_get_contents($item->link, false, $context);
|
||||
$article = file_get_contents($url, false, $context);
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTML($article);
|
||||
$finder = new DomXPath($doc);
|
||||
|
||||
$title = $item->title;
|
||||
$author = $item->xpath('dc:creator')[0];
|
||||
$date = $item->pubDate;
|
||||
$summary = $item->description;
|
||||
|
||||
// strip images
|
||||
$toremove = $finder->query('//svg');
|
||||
foreach ($toremove as $elt)
|
||||
|
@ -355,7 +361,7 @@
|
|||
|
||||
$result = '<h1>' . $title . '</h1>';
|
||||
$result .= '<p>' . $author . '</p>';
|
||||
$result .= '<p>' . $item->pubDate . '</p>';
|
||||
$result .= '<p>' . $date . '</p>';
|
||||
$result .= '<p><b>' . $summary . '</b></p>';
|
||||
|
||||
$nodes = $finder->query('//div[contains(@class, "paywall-restricted-content")]');
|
||||
|
@ -501,8 +507,6 @@
|
|||
foreach ($items as $item)
|
||||
{
|
||||
$title = $item->title;
|
||||
|
||||
$category = $item->xpath('dc:subject')[0];
|
||||
$author = $item->xpath('dc:creator')[0];
|
||||
$summary = $item->description;
|
||||
|
||||
|
|
Loading…
Reference in New Issue