Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
3c61dc2b57
7 changed files with 123 additions and 55 deletions
29
.travis.yml
29
.travis.yml
|
@ -1,11 +1,23 @@
|
||||||
|
dist: trusty
|
||||||
|
sudo: false
|
||||||
language: php
|
language: php
|
||||||
php:
|
|
||||||
- '5.6'
|
before_install:
|
||||||
- '7.0'
|
# Circumvent a bug in current Travis CI builds using Ubuntu Trusty, where the
|
||||||
- hhvm
|
# include_path is wrong.
|
||||||
- nightly
|
#
|
||||||
|
# Default is:
|
||||||
|
# - include_path='.:/home/travis/.phpenv/versions/5.6.31/share/pear'
|
||||||
|
#
|
||||||
|
# Should be:
|
||||||
|
# - include_path='.:/home/travis/.phpenv/versions/5.6.31/lib/php/pear'
|
||||||
|
#
|
||||||
|
# This applies to all builds except hhvm and nightly. Once the distro is fixed
|
||||||
|
# the following line can be removed
|
||||||
|
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "5" || ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then echo "include_path='.:/home/travis/.phpenv/versions/$(phpenv version-name)/lib/php/pear'" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- pear channel-update pear.php.net
|
||||||
- pear install PHP_CodeSniffer
|
- pear install PHP_CodeSniffer
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
@ -14,6 +26,13 @@ script:
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
|
||||||
|
include:
|
||||||
|
- php: 5.6
|
||||||
|
- php: 7.0
|
||||||
|
- php: hhvm
|
||||||
|
- php: nightly
|
||||||
|
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: hhvm
|
- php: hhvm
|
||||||
- php: nightly
|
- php: nightly
|
|
@ -3,24 +3,28 @@ class Arte7Bridge extends BridgeAbstract {
|
||||||
|
|
||||||
const MAINTAINER = 'mitsukarenai';
|
const MAINTAINER = 'mitsukarenai';
|
||||||
const NAME = 'Arte +7';
|
const NAME = 'Arte +7';
|
||||||
const URI = 'http://www.arte.tv/';
|
const URI = 'https://www.arte.tv/';
|
||||||
const CACHE_TIMEOUT = 1800; // 30min
|
const CACHE_TIMEOUT = 1800; // 30min
|
||||||
const DESCRIPTION = 'Returns newest videos from ARTE +7';
|
const DESCRIPTION = 'Returns newest videos from ARTE +7';
|
||||||
|
|
||||||
|
const API_TOKEN = 'Nzc1Yjc1ZjJkYjk1NWFhN2I2MWEwMmRlMzAzNjI5NmU3NWU3ODg4ODJjOWMxNTMxYzEzZGRjYjg2ZGE4MmIwOA';
|
||||||
|
|
||||||
const PARAMETERS = array(
|
const PARAMETERS = array(
|
||||||
'Catégorie (Français)' => array(
|
'Catégorie (Français)' => array(
|
||||||
'catfr' => array(
|
'catfr' => array(
|
||||||
'type' => 'list',
|
'type' => 'list',
|
||||||
'name' => 'Catégorie',
|
'name' => 'Catégorie',
|
||||||
'values' => array(
|
'values' => array(
|
||||||
'Toutes les vidéos (français)' => 'toutes-les-videos',
|
'Toutes les vidéos (français)' => null,
|
||||||
'Actu & société' => 'actu-société',
|
'Actu & société' => 'ACT',
|
||||||
'Séries & fiction' => 'séries-fiction',
|
'Séries & fiction' => 'SER',
|
||||||
'Cinéma' => 'cinéma',
|
'Cinéma' => 'CIN',
|
||||||
'Arts & spectacles classiques' => 'arts-spectacles-classiques',
|
'Arts & spectacles classiques' => 'ARS',
|
||||||
'Culture pop' => 'culture-pop',
|
'Culture pop' => 'CPO',
|
||||||
'Découverte' => 'découverte',
|
'Découverte' => 'DEC',
|
||||||
'Histoire' => 'histoire',
|
'Histoire' => 'HIST',
|
||||||
'Junior' => 'junior'
|
'Science' => 'SCI',
|
||||||
|
'Autre' => 'AUT'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -29,15 +33,16 @@ class Arte7Bridge extends BridgeAbstract {
|
||||||
'type' => 'list',
|
'type' => 'list',
|
||||||
'name' => 'Catégorie',
|
'name' => 'Catégorie',
|
||||||
'values' => array(
|
'values' => array(
|
||||||
'Alle Videos (deutsch)' => 'alle-videos',
|
'Alle Videos (deutsch)' => null,
|
||||||
'Aktuelles & Gesellschaft' => 'aktuelles-gesellschaft',
|
'Aktuelles & Gesellschaft' => 'ACT',
|
||||||
'Fernsehfilme & Serien' => 'fernsehfilme-serien',
|
'Fernsehfilme & Serien' => 'SER',
|
||||||
'Kino' => 'kino',
|
'Kino' => 'CIN',
|
||||||
'Kunst & Kultur' => 'kunst-kultur',
|
'Kunst & Kultur' => 'ARS',
|
||||||
'Popkultur & Alternativ' => 'popkultur-alternativ',
|
'Popkultur & Alternativ' => 'CPO',
|
||||||
'Entdeckung' => 'entdeckung',
|
'Entdeckung' => 'DEC',
|
||||||
'Geschichte' => 'geschichte',
|
'Geschichte' => 'HIST',
|
||||||
'Junior' => 'junior'
|
'Wissenschaft' => 'SCI',
|
||||||
|
'Sonstiges' => 'AUT'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -55,44 +60,39 @@ class Arte7Bridge extends BridgeAbstract {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = self::URI . 'guide/' . $lang . '/plus7/' . $category;
|
$url = 'https://api.arte.tv/api/opa/v3/videos?sort=broadcastBegin&limit=10&language='
|
||||||
$input = getContents($url) or die('Could not request ARTE.');
|
. $lang
|
||||||
|
. ($category != null ? '&category.code=' . $category : '');
|
||||||
|
|
||||||
if(strpos($input, 'categoryVideoSet') !== false) {
|
$context = array(
|
||||||
$input = explode('categoryVideoSet="', $input);
|
'http' => array(
|
||||||
$input = explode('}}', $input[1]);
|
'header' => 'Authorization: Bearer '. self::API_TOKEN
|
||||||
$input = $input[0] . '}}';
|
)
|
||||||
} else {
|
);
|
||||||
$input = explode('videoSet="', $input);
|
|
||||||
$input = explode('}]}', $input[1]);
|
|
||||||
$input = $input[0] . '}]}';
|
|
||||||
}
|
|
||||||
|
|
||||||
$input_json = json_decode(html_entity_decode($input, ENT_QUOTES), true);
|
$input = getContents($url, false, stream_context_create($context)) or die('Could not request ARTE.');
|
||||||
|
$input_json = json_decode($input, true);
|
||||||
|
|
||||||
foreach($input_json['videos'] as $element) {
|
foreach($input_json['videos'] as $element) {
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['uri'] = str_replace("autoplay=1", "", $element['url']);
|
$item['uri'] = $element['url'];
|
||||||
$item['id'] = $element['id'];
|
$item['id'] = $element['id'];
|
||||||
|
|
||||||
$hack_broadcast_time = $element['rights_end'];
|
$item['timestamp'] = strtotime($element['videoRightsBegin']);
|
||||||
$hack_broadcast_time = strtok($hack_broadcast_time, 'T');
|
|
||||||
$hack_broadcast_time = strtok('T');
|
|
||||||
|
|
||||||
$item['timestamp'] = strtotime($element['scheduled_on'] . 'T' . $hack_broadcast_time);
|
|
||||||
$item['title'] = $element['title'];
|
$item['title'] = $element['title'];
|
||||||
|
|
||||||
if(!empty($element['subtitle']))
|
if(!empty($element['subtitle']))
|
||||||
$item['title'] = $element['title'] . ' | ' . $element['subtitle'];
|
$item['title'] = $element['title'] . ' | ' . $element['subtitle'];
|
||||||
|
|
||||||
$item['duration'] = round((int)$element['duration'] / 60);
|
$item['duration'] = round((int)$element['durationSeconds'] / 60);
|
||||||
$item['content'] = $element['teaser']
|
$item['content'] = $element['teaserText']
|
||||||
. '<br><br>'
|
. '<br><br>'
|
||||||
. $item['duration']
|
. $item['duration']
|
||||||
. 'min<br><a href="'
|
. 'min<br><a href="'
|
||||||
. $item['uri']
|
. $item['uri']
|
||||||
. '"><img src="'
|
. '"><img src="'
|
||||||
. $element['thumbnail_url']
|
. $element['mainImage']['url']
|
||||||
. '" /></a>';
|
. '" /></a>';
|
||||||
|
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
|
|
|
@ -20,7 +20,7 @@ class GoComicsBridge extends BridgeAbstract {
|
||||||
|
|
||||||
foreach($html->find('div.comic__container') as $element) {
|
foreach($html->find('div.comic__container') as $element) {
|
||||||
|
|
||||||
$img = $element->find('img', 0);
|
$img = $element->find('.item-comic-image img', 0);
|
||||||
$link = $element->find('a.js-item-comic-link', 0);
|
$link = $element->find('a.js-item-comic-link', 0);
|
||||||
$comic = $img->src;
|
$comic = $img->src;
|
||||||
$title = $link->title;
|
$title = $link->title;
|
||||||
|
|
|
@ -3,7 +3,7 @@ class Torrent9Bridge extends BridgeAbstract {
|
||||||
|
|
||||||
const MAINTAINER = 'lagaisse';
|
const MAINTAINER = 'lagaisse';
|
||||||
const NAME = 'Torrent9 Bridge';
|
const NAME = 'Torrent9 Bridge';
|
||||||
const URI = 'http://www.torrent9.biz';
|
const URI = 'http://www.torrent9.pe';
|
||||||
const CACHE_TIMEOUT = 86400; // 24h = 86400s
|
const CACHE_TIMEOUT = 86400; // 24h = 86400s
|
||||||
const DESCRIPTION = 'Returns latest torrents';
|
const DESCRIPTION = 'Returns latest torrents';
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,25 @@ class TwitterBridge extends BridgeAbstract {
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'title' => 'Hide retweets'
|
'title' => 'Hide retweets'
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
'By list' => array(
|
||||||
|
'user' => array(
|
||||||
|
'name' => 'User',
|
||||||
|
'required' => true,
|
||||||
|
'exampleValue' => 'sebsauvage',
|
||||||
|
'title' => 'Insert a user name'
|
||||||
|
),
|
||||||
|
'list' => array(
|
||||||
|
'name' => 'List',
|
||||||
|
'required' => true,
|
||||||
|
'title' => 'Insert the list name'
|
||||||
|
),
|
||||||
|
'filter' => array(
|
||||||
|
'name' => 'Filter',
|
||||||
|
'exampleValue' => '#rss-bridge',
|
||||||
|
'required' => false,
|
||||||
|
'title' => 'Specify term to search for'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -57,6 +76,10 @@ class TwitterBridge extends BridgeAbstract {
|
||||||
$specific = '@';
|
$specific = '@';
|
||||||
$param = 'u';
|
$param = 'u';
|
||||||
break;
|
break;
|
||||||
|
case 'By list':
|
||||||
|
$specific = $this->getInput('user');
|
||||||
|
$param = 'list';
|
||||||
|
break;
|
||||||
default: return parent::getName();
|
default: return parent::getName();
|
||||||
}
|
}
|
||||||
return 'Twitter ' . $specific . $this->getInput($param);
|
return 'Twitter ' . $specific . $this->getInput($param);
|
||||||
|
@ -74,6 +97,11 @@ class TwitterBridge extends BridgeAbstract {
|
||||||
. urlencode($this->getInput('u'));
|
. urlencode($this->getInput('u'));
|
||||||
// Always return without replies!
|
// Always return without replies!
|
||||||
// . ($this->getInput('norep') ? '' : '/with_replies');
|
// . ($this->getInput('norep') ? '' : '/with_replies');
|
||||||
|
case 'By list':
|
||||||
|
return self::URI
|
||||||
|
. urlencode($this->getInput('user'))
|
||||||
|
. '/lists/'
|
||||||
|
. str_replace(' ', '-', strtolower($this->getInput('list')));
|
||||||
default: return parent::getURI();
|
default: return parent::getURI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +116,8 @@ class TwitterBridge extends BridgeAbstract {
|
||||||
returnServerError('No results for this query.');
|
returnServerError('No results for this query.');
|
||||||
case 'By username':
|
case 'By username':
|
||||||
returnServerError('Requested username can\'t be found.');
|
returnServerError('Requested username can\'t be found.');
|
||||||
|
case 'By list':
|
||||||
|
returnServerError('Requested username or list can\'t be found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,6 +162,18 @@ class TwitterBridge extends BridgeAbstract {
|
||||||
// generate the title
|
// generate the title
|
||||||
$item['title'] = strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '<a>'));
|
$item['title'] = strip_tags($this->fixAnchorSpacing($tweet->find('p.js-tweet-text', 0), '<a>'));
|
||||||
|
|
||||||
|
switch($this->queriedContext) {
|
||||||
|
case 'By list':
|
||||||
|
// Check if filter applies to list (using raw content)
|
||||||
|
if(!is_null($this->getInput('filter'))) {
|
||||||
|
if(stripos($tweet->find('p.js-tweet-text', 0)->plaintext, $this->getInput('filter')) === false) {
|
||||||
|
continue 2; // switch + for-loop!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
$this->processContentLinks($tweet);
|
$this->processContentLinks($tweet);
|
||||||
$this->processEmojis($tweet);
|
$this->processEmojis($tweet);
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$vid = str_replace('yt:video:', '', $element->find('id', 0)->plaintext);
|
$vid = str_replace('yt:video:', '', $element->find('id', 0)->plaintext);
|
||||||
$time = strtotime($element->find('published', 0)->plaintext);
|
$time = strtotime($element->find('published', 0)->plaintext);
|
||||||
|
if(strpos($vid, 'googleads') === false)
|
||||||
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
|
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
|
||||||
}
|
}
|
||||||
$this->request = $this->ytBridgeFixTitle($xml->find('feed > title', 0)->plaintext);
|
$this->request = $this->ytBridgeFixTitle($xml->find('feed > title', 0)->plaintext);
|
||||||
|
@ -104,7 +105,7 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
$vid = str_replace('/watch?v=', '', $element->find('a', 0)->href);
|
$vid = str_replace('/watch?v=', '', $element->find('a', 0)->href);
|
||||||
$vid = substr($vid, 0, strpos($vid, '&') ?: strlen($vid));
|
$vid = substr($vid, 0, strpos($vid, '&') ?: strlen($vid));
|
||||||
$title = $this->ytBridgeFixTitle($element->find($title_selector, 0)->plaintext);
|
$title = $this->ytBridgeFixTitle($element->find($title_selector, 0)->plaintext);
|
||||||
if($title != '[Private Video]') {
|
if($title != '[Private Video]' && strpos($vid, 'googleads') === false) {
|
||||||
$this->ytBridgeQueryVideoInfo($vid, $author, $desc, $time);
|
$this->ytBridgeQueryVideoInfo($vid, $author, $desc, $time);
|
||||||
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
|
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
|
||||||
$count++;
|
$count++;
|
||||||
|
|
18
index.php
18
index.php
|
@ -28,6 +28,14 @@ define('CACHE_DIR', __DIR__ . '/cache');
|
||||||
// Specify path for whitelist file
|
// Specify path for whitelist file
|
||||||
define('WHITELIST_FILE', __DIR__ . '/whitelist.txt');
|
define('WHITELIST_FILE', __DIR__ . '/whitelist.txt');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Move the CLI arguments to the $_GET array, in order to be able to use
|
||||||
|
rss-bridge from the command line
|
||||||
|
*/
|
||||||
|
parse_str(implode('&', array_slice($argv, 1)), $cliArgs);
|
||||||
|
$params = array_merge($_GET, $cliArgs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create a file named 'DEBUG' for enabling debug mode.
|
Create a file named 'DEBUG' for enabling debug mode.
|
||||||
For further security, you may put whitelisted IP addresses in the file,
|
For further security, you may put whitelisted IP addresses in the file,
|
||||||
|
@ -124,8 +132,8 @@ try {
|
||||||
$whitelist_selection = array_map('strtolower', $whitelist_selection);
|
$whitelist_selection = array_map('strtolower', $whitelist_selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = filter_input(INPUT_GET, 'action');
|
$action = array_key_exists('action', $params) ? $params['action'] : null;
|
||||||
$bridge = filter_input(INPUT_GET, 'bridge');
|
$bridge = array_key_exists('bridge', $params) ? $params['bridge'] : null;
|
||||||
|
|
||||||
if($action === 'display' && !empty($bridge)) {
|
if($action === 'display' && !empty($bridge)) {
|
||||||
// DEPRECATED: 'nameBridge' scheme is replaced by 'name' in bridge parameter values
|
// DEPRECATED: 'nameBridge' scheme is replaced by 'name' in bridge parameter values
|
||||||
|
@ -134,7 +142,7 @@ try {
|
||||||
$bridge = substr($bridge, 0, $pos);
|
$bridge = substr($bridge, 0, $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = filter_input(INPUT_GET, 'format')
|
$format = $params['format']
|
||||||
or returnClientError('You must specify a format!');
|
or returnClientError('You must specify a format!');
|
||||||
|
|
||||||
// DEPRECATED: 'nameFormat' scheme is replaced by 'name' in format parameter values
|
// DEPRECATED: 'nameFormat' scheme is replaced by 'name' in format parameter values
|
||||||
|
@ -152,13 +160,11 @@ try {
|
||||||
// Data retrieval
|
// Data retrieval
|
||||||
$bridge = Bridge::create($bridge);
|
$bridge = Bridge::create($bridge);
|
||||||
|
|
||||||
$noproxy = filter_input(INPUT_GET, '_noproxy', FILTER_VALIDATE_BOOLEAN);
|
$noproxy = array_key_exists('_noproxy', $params) && filter_var($params['_noproxy'], FILTER_VALIDATE_BOOLEAN);
|
||||||
if(defined('PROXY_URL') && PROXY_BYBRIDGE && $noproxy) {
|
if(defined('PROXY_URL') && PROXY_BYBRIDGE && $noproxy) {
|
||||||
define('NOPROXY', true);
|
define('NOPROXY', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = $_GET;
|
|
||||||
|
|
||||||
// Initialize cache
|
// Initialize cache
|
||||||
$cache = Cache::create('FileCache');
|
$cache = Cache::create('FileCache');
|
||||||
$cache->setPath(CACHE_DIR);
|
$cache->setPath(CACHE_DIR);
|
||||||
|
|
Loading…
Reference in a new issue