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
|
* @name Facebook
|
||||||
* @homepage http://facebook.com/
|
* @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
|
* @update 03/08/2015
|
||||||
* @maintainer teromene
|
* @maintainer teromene
|
||||||
* @use1(u="username")
|
* @use1(u="username")
|
||||||
|
@ -16,10 +16,15 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
if(isset($param['u'])) {
|
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);
|
$html = file_get_html('https://facebook.com/'.urlencode($param['u']).'?_fb_noscript=1') or $this->returnError('No results for this query.', 404);
|
||||||
} else {
|
} 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);
|
$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);
|
$element = $html->find("[id^=PagePostsSectionPagelet-]")[0]->children(0)->children(0);
|
||||||
|
|
||||||
|
if(isset($element)) {
|
||||||
|
|
||||||
foreach($element->children() as $post) {
|
foreach($element->children() as $post) {
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
|
@ -50,7 +57,8 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
$date = 0;
|
$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->content = $content;
|
||||||
$item->title = $param['u']." | ".strip_tags($content);
|
$item->title = $param['u']." | ".strip_tags($content);
|
||||||
$item->timestamp = $date;
|
$item->timestamp = $date;
|
||||||
|
@ -58,7 +66,7 @@ class FacebookBridge extends BridgeAbstract{
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue