[bridges] use BridgeAbstract::getContents instead of file_get_contents

use of the proxy feature when enabled

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-22 23:39:40 +02:00
parent 747e54d64a
commit 4a1f360d39
8 changed files with 10 additions and 10 deletions

View file

@ -74,7 +74,7 @@ class AnimeUltimeBridge extends BridgeAbstract {
if (!empty($item_uri)) {
//Retrieve description from description page and convert relative image src info absolute image src
$html_item = file_get_contents($item_uri) or $this->returnServerError('Could not request Anime-Ultime: '.$item_uri);
$html_item = $this->getContents($item_uri) or $this->returnServerError('Could not request Anime-Ultime: '.$item_uri);
$item_description = substr($html_item, strpos($html_item, 'class="principal_contain" align="center">') + 41);
$item_description = substr($item_description, 0, strpos($item_description, '<div id="table">'));
$item_description = str_replace('src="images', 'src="'.$website.'images', $item_description);

View file

@ -51,7 +51,7 @@ class Arte7Bridge extends BridgeAbstract{
function extractVideoset($category='toutes-les-videos', $lang='fr')
{
$url = 'http://www.arte.tv/guide/'.$lang.'/plus7/'.$category;
$input = file_get_contents($url) or die('Could not request ARTE.');
$input = $this->getContents($url) or die('Could not request ARTE.');
if(strpos($input, 'categoryVideoSet') !== FALSE)
{
$input = explode('categoryVideoSet: ', $input);

View file

@ -93,7 +93,7 @@ class FacebookBridge extends BridgeAbstract{
),
);
$context = stream_context_create($http_options);
$html = file_get_contents($captcha_action, false, $context);
$html = $this->getContents($captcha_action, false, $context);
if ($html === FALSE) { $this->returnServerError('Failed to submit captcha response back to Facebook'); }
unset($_SESSION['captcha_fields']);
$html = str_get_html($html);
@ -129,7 +129,7 @@ class FacebookBridge extends BridgeAbstract{
$_SESSION['captcha_action'] = 'https://www.facebook.com'.$captcha->find('form', 0)->action;
//Show captcha filling form to the viewer, proxying the captcha image
$img = base64_encode(file_get_contents($captcha->find('img', 0)->src));
$img = base64_encode($this->getContents($captcha->find('img', 0)->src));
header('HTTP/1.1 500 '.Http::getMessageForCode(500));
header('Content-Type: text/html');
die('<form method="post" action="?'.$_SERVER['QUERY_STRING'].'">'

View file

@ -25,7 +25,7 @@ class FlickrExploreBridge extends BridgeAbstract{
$imageID = reset($imageURIs);
// Get the image JSON via Flickr API
$imageJSON = json_decode(file_get_contents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long...
$imageJSON = json_decode($this->getContents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long...
$item = array();
$item['uri'] = 'https://flickr.com/photo.gne?id='.$imageID;

View file

@ -102,7 +102,7 @@ class MangareaderBridge extends BridgeAbstract{
}
// We'll use the DOM parser for this as it makes navigation easier
$html = file_get_contents("http://www.mangareader.net/" . $path);
$html = $this->getContents("http://www.mangareader.net/" . $path);
if(!$html){
$this->returnClientError('Could not receive data for ' . $path . '!');
}

View file

@ -37,7 +37,7 @@ class Releases3DSBridge extends BridgeAbstract {
}
$dataUrl = 'http://3dsdb.com/xml.php';
$xml = file_get_contents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl);
$xml = $this->getContents($dataUrl) or $this->returnServerError('Could not request 3dsdb: '.$dataUrl);
$limit = 0;
foreach (array_reverse(explode('<release>', $xml)) as $element) {

View file

@ -13,7 +13,7 @@ class Rue89Bridge extends BridgeAbstract{
private function rue89getDatas($url){
$url = "http://api.rue89.nouvelobs.com/export/mobile2/node/" . str_replace(" ", "", substr($url, -8)) . "/full";
$datas = json_decode(file_get_contents($url), true);
$datas = json_decode($this->getContents($url), true);
return $datas["node"];

View file

@ -28,8 +28,8 @@ class SoundCloudBridge extends BridgeAbstract{
{
$this->request = $param['u'];
$res = json_decode(file_get_contents('https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'. urlencode($this->request) .'&client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this query');
$tracks = json_decode(file_get_contents('https://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks?client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this user');
$res = json_decode($this->getContents('https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'. urlencode($this->request) .'&client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this query');
$tracks = json_decode($this->getContents('https://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks?client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this user');
}
else
{