[FB2Bridge] Add updated timestamps to each post (#849)
Additionally, exclude shared posts from output since they already exist inside other posts.
This commit is contained in:
parent
7561c0685d
commit
6fce03daa7
1 changed files with 15 additions and 7 deletions
|
@ -97,8 +97,14 @@ EOD;
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
||||||
$item['uri'] = 'http://touch.facebook.com'
|
preg_match('/publish_time\\\":([0-9]+),/', $content->getAttribute('data-store', 0), $match);
|
||||||
. $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href');
|
if(isset($match[1]))
|
||||||
|
$timestamp = $match[1];
|
||||||
|
else
|
||||||
|
$timestamp = 0;
|
||||||
|
|
||||||
|
$item['uri'] = html_entity_decode('http://touch.facebook.com'
|
||||||
|
. $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href'), ENT_QUOTES);
|
||||||
|
|
||||||
if($content->find('header', 0) !== null) {
|
if($content->find('header', 0) !== null) {
|
||||||
$content->find('header', 0)->innertext = '';
|
$content->find('header', 0)->innertext = '';
|
||||||
|
@ -135,7 +141,7 @@ EOD;
|
||||||
// "<i><u>smile emoticon</u></i>" back to ASCII emoticons eg ":)"
|
// "<i><u>smile emoticon</u></i>" back to ASCII emoticons eg ":)"
|
||||||
$content = preg_replace_callback('/<i><u>([^ <>]+) ([^<>]+)<\/u><\/i>/i', $unescape_fb_emote, $content);
|
$content = preg_replace_callback('/<i><u>([^ <>]+) ([^<>]+)<\/u><\/i>/i', $unescape_fb_emote, $content);
|
||||||
|
|
||||||
$item['content'] = $content;
|
$item['content'] = html_entity_decode($content, ENT_QUOTES);
|
||||||
|
|
||||||
$title = $author;
|
$title = $author;
|
||||||
if (strlen($title) > 24)
|
if (strlen($title) > 24)
|
||||||
|
@ -144,9 +150,11 @@ EOD;
|
||||||
if (strlen($title) > 64)
|
if (strlen($title) > 64)
|
||||||
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...';
|
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...';
|
||||||
|
|
||||||
$item['title'] = $title;
|
$item['title'] = html_entity_decode($title, ENT_QUOTES);
|
||||||
$item['author'] = $author;
|
$item['author'] = html_entity_decode($author, ENT_QUOTES);
|
||||||
|
$item['timestamp'] = html_entity_decode($timestamp, ENT_QUOTES);
|
||||||
|
|
||||||
|
if($item['timestamp'] != 0)
|
||||||
array_push($this->items, $item);
|
array_push($this->items, $item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +202,7 @@ EOD;
|
||||||
// /div>","replaceifexists
|
// /div>","replaceifexists
|
||||||
$regex = '/\\"html\\":(\".+\/div>"),"replace/';
|
$regex = '/\\"html\\":(\".+\/div>"),"replace/';
|
||||||
preg_match($regex, $pageContent, $result);
|
preg_match($regex, $pageContent, $result);
|
||||||
return str_get_html(html_entity_decode(json_decode($result[1])));
|
return str_get_html(json_decode($result[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue