Ajout du support des journaux de profils
This commit is contained in:
parent
a9052b211e
commit
ee4d4d9603
1 changed files with 31 additions and 23 deletions
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* @name Facebook
|
||||
* @homepage http://facebook.com/
|
||||
* @description Facebook bridge
|
||||
* @description Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117
|
||||
* @update 03/08/2015
|
||||
* @maintainer teromene
|
||||
* @use1(u="username")
|
||||
|
@ -16,10 +16,15 @@ class FacebookBridge extends BridgeAbstract{
|
|||
$html = '';
|
||||
|
||||
if(isset($param['u'])) {
|
||||
|
||||
if(!strpos($param['u'], "/")) {
|
||||
$html = file_get_html('https://facebook.com/'.urlencode($param['u']).'?_fb_noscript=1') or $this->returnError('No results for this query.', 404);
|
||||
} else {
|
||||
|
||||
$html = file_get_html('https://facebook.com/pages/'.$param['u'].'?_fb_noscript=1') or $this->returnError('No results for this query.', 404);
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->returnError('You must specify a Facebook username.', 400);
|
||||
|
||||
}
|
||||
|
@ -28,6 +33,8 @@ class FacebookBridge extends BridgeAbstract{
|
|||
|
||||
$element = $html->find("[id^=PagePostsSectionPagelet-]")[0]->children(0)->children(0);
|
||||
|
||||
if(isset($element)) {
|
||||
|
||||
foreach($element->children() as $post) {
|
||||
|
||||
$item = new \Item();
|
||||
|
@ -50,7 +57,8 @@ class FacebookBridge extends BridgeAbstract{
|
|||
$date = 0;
|
||||
}
|
||||
|
||||
$item->uri = 'https://facebook.com'.$post->find("abbr")[0]->parent()->getAttribute("href");
|
||||
$item->uri = 'https://facebook.com'.str_replace("&", "&", $post->find("abbr")[0]->parent()->getAttribute("href"));
|
||||
|
||||
$item->content = $content;
|
||||
$item->title = $param['u']." | ".strip_tags($content);
|
||||
$item->timestamp = $date;
|
||||
|
@ -58,7 +66,7 @@ class FacebookBridge extends BridgeAbstract{
|
|||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue