Browse Source

use consistent pattern for fetching from silos

pull/49/head
Aaron Parecki 7 years ago
parent
commit
0ccf34b656
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 10 additions and 15 deletions
  1. +1
    -13
      lib/XRay/Fetcher.php
  2. +9
    -2
      lib/XRay/Formats/Twitter.php

+ 1
- 13
lib/XRay/Fetcher.php View File

@ -145,19 +145,7 @@ class Fetcher {
];
}
$tweet = Formats\Twitter::fetch($url, $creds);
if(!$tweet) {
return [
'error' => 'twitter_error',
'error_description' => $e->getMessage()
];
}
return [
'url' => $url,
'body' => $tweet,
'code' => 200,
];
return Formats\Twitter::fetch($url, $creds);
}
private function _fetch_github($url, $opts) {

+ 9
- 2
lib/XRay/Formats/Twitter.php View File

@ -33,10 +33,17 @@ class Twitter extends Format {
try {
$tweet = $twitter->request('statuses/show/'.$tweet_id, 'GET', ['tweet_mode'=>'extended']);
} catch(\TwitterException $e) {
return false;
return [
'error' => 'twitter_error',
'error_description' => $e->getMessage()
];
}
return $tweet;
return [
'url' => $url,
'body' => $tweet,
'code' => 200,
];
}
public static function parse($json, $url) {

Loading…
Cancel
Save