forked from blallo/rss-bridge
[Facebook] make guids really permanent
Some facebook tracking query parameter was getting inside the <link> and <guid> tags. This commit strips them off so that a feed reader won't think there are always new posts.
This commit is contained in:
parent
c1494adace
commit
3821ca9737
1 changed files with 10 additions and 2 deletions
|
@ -165,6 +165,14 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
return htmlspecialchars_decode($ogtitle->content, ENT_QUOTES);
|
return htmlspecialchars_decode($ogtitle->content, ENT_QUOTES);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private function uri_strip_args($uri) {
|
||||||
|
$clean = strtok($uri, '?');
|
||||||
|
if($clean === FALSE) {
|
||||||
|
return $uri;
|
||||||
|
} else {
|
||||||
|
return $clean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function extractGroupURI($post) {
|
private function extractGroupURI($post) {
|
||||||
|
|
||||||
|
@ -175,7 +183,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
|
|
||||||
// Find the one that is a permalink
|
// Find the one that is a permalink
|
||||||
if(strpos($anchor->href, 'permalink') !== false) {
|
if(strpos($anchor->href, 'permalink') !== false) {
|
||||||
return $anchor->href;
|
return $this->uri_strip_args($anchor->href);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -539,7 +547,7 @@ EOD;
|
||||||
$uri = self::URI . $post->find('abbr')[0]->parent()->getAttribute('href');
|
$uri = self::URI . $post->find('abbr')[0]->parent()->getAttribute('href');
|
||||||
|
|
||||||
//Build and add final item
|
//Build and add final item
|
||||||
$item['uri'] = htmlspecialchars_decode($uri);
|
$item['uri'] = $this->uri_strip_args(htmlspecialchars_decode($uri));
|
||||||
$item['content'] = htmlspecialchars_decode($content);
|
$item['content'] = htmlspecialchars_decode($content);
|
||||||
$item['title'] = $title;
|
$item['title'] = $title;
|
||||||
$item['author'] = $author;
|
$item['author'] = $author;
|
||||||
|
|
Loading…
Reference in a new issue