summaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-02 13:59:37 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-02 13:59:37 +0200
commitea87d8d09697388cef5ddba3ba8df76bf4374cdd (patch)
treecc2d4330e16398afea3008b434d5f09dfbb46f7a /utility
parent76fd21bccd1b87916f149a257e07d02f5e40335a (diff)
add comment for twitter fetcher
Diffstat (limited to 'utility')
-rw-r--r--utility/twitterfetcher.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/utility/twitterfetcher.php b/utility/twitterfetcher.php
index 0d1d6738b..7e09ddcb9 100644
--- a/utility/twitterfetcher.php
+++ b/utility/twitterfetcher.php
@@ -32,9 +32,17 @@ class TwitterFetcher implements IFeedFetcher {
private $fetcher;
private $regex;
- // FIXME: implement twitter api to be future proof
+
public function __construct(FeedFetcher $fetcher){
$this->fetcher = $fetcher;
+
+ // matches the following urls and extracts the username
+ // https://twitter.com/GeorgeTakei
+ // https://www.twitter.com/GeorgeTakei
+ // http://twitter.com/GeorgeTakei
+ // http://www.twitter.com/GeorgeTakei
+ // www.twitter.com/GeorgeTakei
+ // twitter.com/GeorgeTakei
$this->regex = '/^(?:https?:\/\/)?(?:www\.)?' .
'twitter.com\/([\pL\pN\pM]+)$/u';
}
@@ -47,8 +55,13 @@ class TwitterFetcher implements IFeedFetcher {
public function fetch($url){
preg_match($this->regex, $url, $match);
+
+ // FIXME: implement twitter api to be future proof
+ // deprecated Twitter RSS API
$rssUrl = 'https://api.twitter.com/1/statuses/user_timeline.' .
'rss?screen_name=' . $match[1];
+
+ // use transformed url to fetch the rss feeds with the default fetcher
return $this->fetcher->fetch($rssUrl);
}