diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..e1f37170
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,35 @@
+name: Lint
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ phpcs:
+ runs-on: ubuntu-16.04
+ strategy:
+ matrix:
+ php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
+ steps:
+ - uses: actions/checkout@v2
+ - uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ tools: phpcs
+ - run: phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p
+
+ phpcompatibility:
+ runs-on: ubuntu-16.04
+ strategy:
+ matrix:
+ php-versions: ['5.6', '7.4']
+ steps:
+ - uses: actions/checkout@v2
+ - uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ - run: composer global require dealerdirect/phpcodesniffer-composer-installer
+ - run: composer global require phpcompatibility/php-compatibility
+ - run: ~/.composer/vendor/bin/phpcs . --standard=phpcompatibility.xml --warning-severity=0 --extensions=php -p
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 00000000..29ca71c0
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,47 @@
+name: Tests
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ phpunit6:
+ runs-on: ubuntu-16.04
+ strategy:
+ matrix:
+ php-versions: ['7.0', '7.1', '7.2']
+ steps:
+ - uses: actions/checkout@v2
+ - uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ - run: composer global require phpunit/phpunit ^6
+ - run: phpunit --configuration=phpunit.xml --include-path=lib/
+
+ phpunit7:
+ runs-on: ubuntu-16.04
+ strategy:
+ matrix:
+ php-versions: ['7.1', '7.2', '7.3']
+ steps:
+ - uses: actions/checkout@v2
+ - uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ - run: composer global require phpunit/phpunit ^7
+ - run: phpunit --configuration=phpunit.xml --include-path=lib/
+
+ phpunit8:
+ runs-on: ubuntu-16.04
+ strategy:
+ matrix:
+ php-versions: ['7.3', '7.4']
+ steps:
+ - uses: actions/checkout@v2
+ - uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ - run: composer global require phpunit/phpunit ^8
+ - run: phpunit --configuration=phpunit.xml --include-path=lib/
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 841ac5db..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-dist: trusty
-language: php
-
-install:
- - composer global require dealerdirect/phpcodesniffer-composer-installer;
- - composer global require phpcompatibility/php-compatibility;
- - if [[ "$PHPUNIT" ]]; then
- composer global require phpunit/phpunit ^$PHPUNIT;
- fi
-
-script:
- - phpenv rehash
- # Run PHP_CodeSniffer on all versions
- - ~/.config/composer/vendor/bin/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p;
- # Check PHP compatibility for the lowest and highest supported version
- - if [[ $TRAVIS_PHP_VERSION == "5.6" || $TRAVIS_PHP_VERSION == "7.3" ]]; then
- ~/.config/composer/vendor/bin/phpcs . --standard=phpcompatibility.xml --extensions=php -p;
- fi
- # Run unit tests on highest major version
- - if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then
- ~/.config/composer/vendor/bin/phpunit --configuration=phpunit.xml --include-path=lib/;
- fi
-
-php:
- - 7.3
-
-env:
- - PHPUNIT=6
- - PHPUNIT=7
- - PHPUNIT=8
-
-matrix:
- fast_finish: true
-
- include:
- - php: 5.6
- env: PHPUNIT=
- - php: 7.0
- - php: 7.1
- - php: 7.2
-
- allow_failures:
- - php: 7.3
- env: PHPUNIT=7
- - php: 7.3
- env: PHPUNIT=8
diff --git a/Dockerfile b/Dockerfile
index fa9979d6..4b844541 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,8 +3,13 @@ FROM php:7-apache
ENV APACHE_DOCUMENT_ROOT=/app
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
- && apt-get --yes update && apt-get --yes install libxml2-dev \
- && docker-php-ext-install -j$(nproc) simplexml \
+ && apt-get --yes update \
+ && apt-get --yes --no-install-recommends install \
+ zlib1g-dev \
+ libmemcached-dev \
+ && rm -rf /var/lib/apt/lists/* \
+ && pecl install memcached \
+ && docker-php-ext-enable memcached \
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
&& sed -ri -e 's/(MinProtocol\s*=\s*)TLSv1\.2/\1None/' /etc/ssl/openssl.cnf \
diff --git a/README.md b/README.md
index a9db8eaf..202f3680 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,7 @@ RSS-Bridge requires PHP 5.6 or higher with following extensions enabled:
- [`simplexml`](https://secure.php.net/manual/en/book.simplexml.php)
- [`curl`](https://secure.php.net/manual/en/book.curl.php)
- [`json`](https://secure.php.net/manual/en/book.json.php)
+ - [`filter`](https://secure.php.net/manual/en/book.filter.php)
- [`sqlite3`](http://php.net/manual/en/book.sqlite3.php) (only when using SQLiteCache)
Find more information on our [Wiki](https://github.com/rss-bridge/rss-bridge/wiki)
@@ -119,19 +120,24 @@ https://gist.github.com/LogMANOriginal/da00cd1e5f0ca31cef8e193509b17fd8
* [alexAubin](https://github.com/alexAubin)
* [AmauryCarrade](https://github.com/AmauryCarrade)
* [AntoineTurmel](https://github.com/AntoineTurmel)
+* [arnd-s](https://github.com/arnd-s)
* [ArthurHoaro](https://github.com/ArthurHoaro)
* [Astalaseven](https://github.com/Astalaseven)
* [Astyan-42](https://github.com/Astyan-42)
+* [AxorPL](https://github.com/AxorPL)
+* [ayacoo](https://github.com/ayacoo)
* [az5he6ch](https://github.com/az5he6ch)
* [azdkj532](https://github.com/azdkj532)
* [b1nj](https://github.com/b1nj)
* [benasse](https://github.com/benasse)
+* [Binnette](https://github.com/Binnette)
* [captn3m0](https://github.com/captn3m0)
* [chemel](https://github.com/chemel)
* [ckiw](https://github.com/ckiw)
* [cnlpete](https://github.com/cnlpete)
* [corenting](https://github.com/corenting)
* [couraudt](https://github.com/couraudt)
+* [csisoap](https://github.com/csisoap)
* [cyberjacob](https://github.com/cyberjacob)
* [da2x](https://github.com/da2x)
* [Daiyousei](https://github.com/Daiyousei)
@@ -146,27 +152,36 @@ https://gist.github.com/LogMANOriginal/da00cd1e5f0ca31cef8e193509b17fd8
* [em92](https://github.com/em92)
* [eMerzh](https://github.com/eMerzh)
* [EtienneM](https://github.com/EtienneM)
+* [fanch317](https://github.com/fanch317)
* [floviolleau](https://github.com/floviolleau)
* [fluffy-critter](https://github.com/fluffy-critter)
* [Frenzie](https://github.com/Frenzie)
* [fulmeek](https://github.com/fulmeek)
+* [ggiessen](https://github.com/ggiessen)
* [Ginko-Aloe](https://github.com/Ginko-Aloe)
* [Glandos](https://github.com/Glandos)
* [gloony](https://github.com/gloony)
* [GregThib](https://github.com/GregThib)
* [griffaurel](https://github.com/griffaurel)
* [Grummfy](https://github.com/Grummfy)
+* [gsantner](https://github.com/gsantner)
* [hunhejj](https://github.com/hunhejj)
* [husim0](https://github.com/husim0)
* [IceWreck](https://github.com/IceWreck)
* [j0k3r](https://github.com/j0k3r)
* [JackNUMBER](https://github.com/JackNUMBER)
+* [jannyba](https://github.com/jannyba)
+* [JasonGhent](https://github.com/JasonGhent)
+* [jdesgats](https://github.com/jdesgats)
* [jdigilio](https://github.com/jdigilio)
* [JeremyRand](https://github.com/JeremyRand)
* [Jocker666z](https://github.com/Jocker666z)
* [johnnygroovy](https://github.com/johnnygroovy)
-* [killruana](https://github.com/killruana)
+* [johnpc](https://github.com/johnpc)
+* [joni1993](https://github.com/joni1993)
+* [joshcoales](https://github.com/joshcoales)
* [klimplant](https://github.com/klimplant)
+* [kolarcz](https://github.com/kolarcz)
* [kranack](https://github.com/kranack)
* [kraoc](https://github.com/kraoc)
* [l1n](https://github.com/l1n)
@@ -175,6 +190,7 @@ https://gist.github.com/LogMANOriginal/da00cd1e5f0ca31cef8e193509b17fd8
* [lalannev](https://github.com/lalannev)
* [ldidry](https://github.com/ldidry)
* [Leomaradan](https://github.com/Leomaradan)
+* [liamka](https://github.com/liamka)
* [Limero](https://github.com/Limero)
* [LogMANOriginal](https://github.com/LogMANOriginal)
* [lorenzos](https://github.com/lorenzos)
@@ -185,18 +201,25 @@ https://gist.github.com/LogMANOriginal/da00cd1e5f0ca31cef8e193509b17fd8
* [mdemoss](https://github.com/mdemoss)
* [melangue](https://github.com/melangue)
* [metaMMA](https://github.com/metaMMA)
+* [mibe](https://github.com/mibe)
+* [mightymt](https://github.com/mightymt)
* [mitsukarenai](https://github.com/mitsukarenai)
* [MonsieurPoutounours](https://github.com/MonsieurPoutounours)
* [mr-flibble](https://github.com/mr-flibble)
* [mro](https://github.com/mro)
+* [mschwld](https://github.com/mschwld)
* [mxmehl](https://github.com/mxmehl)
* [nel50n](https://github.com/nel50n)
* [niawag](https://github.com/niawag)
+* [Niehztog](https://github.com/Niehztog)
* [Nono-m0le](https://github.com/Nono-m0le)
* [ObsidianWitch](https://github.com/ObsidianWitch)
* [OliverParoczai](https://github.com/OliverParoczai)
-* [oratosquilla-oratoria](https://github.com/oratosquilla-oratoria)
+* [Ololbu](https://github.com/Ololbu)
* [ORelio](https://github.com/ORelio)
+* [otakuf](https://github.com/otakuf)
+* [Park0](https://github.com/Park0)
+* [Paroleen](https://github.com/Paroleen)
* [PaulVayssiere](https://github.com/PaulVayssiere)
* [pellaeon](https://github.com/pellaeon)
* [Piranhaplant](https://github.com/Piranhaplant)
@@ -206,24 +229,31 @@ https://gist.github.com/LogMANOriginal/da00cd1e5f0ca31cef8e193509b17fd8
* [Pofilo](https://github.com/Pofilo)
* [prysme01](https://github.com/prysme01)
* [quentinus95](https://github.com/quentinus95)
+* [RawkBob](https://github.com/RawkBob)
* [regisenguehard](https://github.com/regisenguehard)
* [Riduidel](https://github.com/Riduidel)
* [rogerdc](https://github.com/rogerdc)
* [Roliga](https://github.com/Roliga)
+* [ronansalmon](https://github.com/ronansalmon)
+* [rremizov](https://github.com/rremizov)
* [sebsauvage](https://github.com/sebsauvage)
* [shutosg](https://github.com/shutosg)
+* [Simounet](https://github.com/Simounet)
* [somini](https://github.com/somini)
* [squeek502](https://github.com/squeek502)
* [stjohnjohnson](https://github.com/stjohnjohnson)
* [Strubbl](https://github.com/Strubbl)
* [sublimz](https://github.com/sublimz)
* [sunchaserinfo](https://github.com/sunchaserinfo)
+* [SuperSandro2000](https://github.com/SuperSandro2000)
* [sysadminstory](https://github.com/sysadminstory)
* [tameroski](https://github.com/tameroski)
* [teromene](https://github.com/teromene)
+* [tgkenney](https://github.com/tgkenney)
* [thefranke](https://github.com/thefranke)
* [ThePadawan](https://github.com/ThePadawan)
* [TheRadialActive](https://github.com/TheRadialActive)
+* [theScrabi](https://github.com/theScrabi)
* [TitiTestScalingo](https://github.com/TitiTestScalingo)
* [triatic](https://github.com/triatic)
* [VerifiedJoseph](https://github.com/VerifiedJoseph)
@@ -231,6 +261,7 @@ https://gist.github.com/LogMANOriginal/da00cd1e5f0ca31cef8e193509b17fd8
* [wtuuju](https://github.com/wtuuju)
* [xurxof](https://github.com/xurxof)
* [yardenac](https://github.com/yardenac)
+* [ymeister](https://github.com/ymeister)
* [ZeNairolf](https://github.com/ZeNairolf)
Licenses
@@ -240,6 +271,7 @@ The source code for RSS-Bridge is [Public Domain](UNLICENSE).
RSS-Bridge uses third party libraries with their own license:
+ * [`Parsedown`](https://github.com/erusev/parsedown) licensed under the [MIT License](http://opensource.org/licenses/MIT)
* [`PHP Simple HTML DOM Parser`](http://simplehtmldom.sourceforge.net/) licensed under the [MIT License](http://opensource.org/licenses/MIT)
* [`php-urljoin`](https://github.com/fluffy-critter/php-urljoin) licensed under the [MIT License](http://opensource.org/licenses/MIT)
diff --git a/actions/DisplayAction.php b/actions/DisplayAction.php
index 579630a1..16a67d54 100644
--- a/actions/DisplayAction.php
+++ b/actions/DisplayAction.php
@@ -131,6 +131,7 @@ class DisplayAction extends ActionAbstract {
try {
$bridge->setDatas($bridge_params);
+ $bridge->loadConfiguration();
$bridge->collectData();
$items = $bridge->getItems();
diff --git a/bridges/ASRockNewsBridge.php b/bridges/ASRockNewsBridge.php
new file mode 100644
index 00000000..1f3f4dda
--- /dev/null
+++ b/bridges/ASRockNewsBridge.php
@@ -0,0 +1,57 @@
+find('div.inner > a') as $index => $a) {
+ $item = array();
+
+ $articlePath = $a->href;
+
+ $articlePageHtml = getSimpleHTMLDOMCached($articlePath, self::CACHE_TIMEOUT)
+ or returnServerError('Could not request: ' . $articlePath);
+
+ $articlePageHtml = defaultLinkTo($articlePageHtml, self::URI);
+
+ $contents = $articlePageHtml->find('div.Contents', 0);
+
+ $item['uri'] = $articlePath;
+ $item['title'] = $contents->find('h5', 0)->innertext;
+
+ $contents->find('h5', 0)->outertext = '';
+
+ $item['content'] = $contents->innertext;
+ $item['timestamp'] = $this->extractDate($a->plaintext);
+ $item['enclosures'][] = $a->find('img', 0)->src;
+ $this->items[] = $item;
+
+ if (count($this->items) >= 10) {
+ break;
+ }
+ }
+ }
+
+ private function extractDate($text) {
+ $dateRegex = '/^([0-9]{4}\/[0-9]{1,2}\/[0-9]{1,2})/';
+
+ $text = trim($text);
+
+ if (preg_match($dateRegex, $text, $matches)) {
+ return $matches[1];
+ }
+
+ return '';
+ }
+}
diff --git a/bridges/AirBreizhBridge.php b/bridges/AirBreizhBridge.php
new file mode 100644
index 00000000..2d852da5
--- /dev/null
+++ b/bridges/AirBreizhBridge.php
@@ -0,0 +1,54 @@
+ array(
+ 'theme' => array(
+ 'name' => 'Thematique',
+ 'type' => 'list',
+ 'values' => array(
+ 'Tout' => '',
+ 'Rapport d\'activite' => 'rapport-dactivite',
+ 'Etude' => 'etudes',
+ 'Information' => 'information',
+ 'Autres documents' => 'autres-documents',
+ 'Plan Régional de Surveillance de la qualité de l’air' => 'prsqa',
+ 'Transport' => 'transport'
+ )
+ )
+ )
+ );
+
+ public function getIcon() {
+ return 'https://www.airbreizh.asso.fr/voy_content/uploads/2017/11/favicon.png';
+ }
+
+ public function collectData(){
+ $html = '';
+ $html = getSimpleHTMLDOM(static::URI . 'publications/?fwp_publications_thematiques=' . $this->getInput('theme'))
+ or returnClientError('No results for this query.');
+
+ foreach ($html->find('article') as $article) {
+ $item = array();
+ // Title
+ $item['title'] = $article->find('h2', 0)->plaintext;
+ // Author
+ $item['author'] = 'Air Breizh';
+ // Image
+ $imagelink = $article->find('.card__image', 0)->find('img', 0)->getAttribute('src');
+ // Content preview
+ $item['content'] = '
+
'
+ . $article->find('.card__text', 0)->plaintext;
+ // URL
+ $item['uri'] = $article->find('.publi__buttons', 0)->find('a', 0)->getAttribute('href');
+ // ID
+ $item['id'] = $article->find('.publi__buttons', 0)->find('a', 0)->getAttribute('href');
+ $this->items[] = $item;
+ }
+ }
+}
diff --git a/bridges/AlbionOnlineBridge.php b/bridges/AlbionOnlineBridge.php
new file mode 100644
index 00000000..0a93901e
--- /dev/null
+++ b/bridges/AlbionOnlineBridge.php
@@ -0,0 +1,74 @@
+ array(
+ 'name' => 'Limit',
+ 'type' => 'number',
+ 'title' => 'Maximum number of items to return',
+ 'defaultValue' => 5,
+ ),
+ 'language' => array(
+ 'name' => 'Language',
+ 'type' => 'list',
+ 'values' => array(
+ 'English' => 'en',
+ 'Deutsch' => 'de',
+ 'Polski' => 'pl',
+ 'Français' => 'fr',
+ 'Русский' => 'ru',
+ 'Português' => 'pt',
+ 'Español' => 'es',
+ ),
+ 'title' => 'Language of changelog posts',
+ 'defaultValue' => 'en',
+ ),
+ 'full' => array(
+ 'name' => 'Full changelog',
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'title' => 'Enable to receive the full changelog post for each item'
+ ),
+ ));
+
+ public function collectData() {
+ $api = 'https://albiononline.com/';
+ // Example: https://albiononline.com/en/changelog/1/5
+ $url = $api . $this->getInput('language') . '/changelog/1/' . $this->getInput('postcount');
+
+ $html = getSimpleHTMLDOM($url)
+ or returnServerError('Unable to get changelog data from "' . $url . '"!');
+
+ foreach ($html->find('li') as $data) {
+ $item = array();
+ $item['uri'] = self::URI . $data->find('a', 0)->getAttribute('href');
+ $item['title'] = trim(explode('|', $data->find('span', 0)->plaintext)[0]);
+ // Time below work only with en lang. Need to think about solution. May be separate request like getFullChangelog, but to english list for all language
+ //print_r( date_parse_from_format( 'M j, Y' , 'Sep 9, 2020') );
+ //$item['timestamp'] = $this->extractDate($a->plaintext);
+ $item['author'] = 'albiononline.com';
+ if($this->getInput('full')) {
+ $item['content'] = $this->getFullChangelog($item['uri']);
+ } else {
+ //$item['content'] = trim(preg_replace('/\s+/', ' ', $data->find('span', 0)->plaintext));
+ // Just use title, no info at all or use title and date, see above
+ $item['content'] = $item['title'];
+ }
+ $item['uid'] = hash('sha256', $item['title']);
+ $this->items[] = $item;
+ }
+ }
+
+ private function getFullChangelog($url) {
+ $html = getSimpleHTMLDOMCached($url)
+ or returnServerError('Unable to load changelog post from "' . $url . '"!');
+ $html = defaultLinkTo($html, self::URI);
+ return $html->find('div.small-12.columns', 1)->innertext;
+ }
+}
diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php
index 17da9031..00fd0e80 100644
--- a/bridges/AllocineFRBridge.php
+++ b/bridges/AllocineFRBridge.php
@@ -8,14 +8,25 @@ class AllocineFRBridge extends BridgeAbstract {
const DESCRIPTION = 'Bridge for allocine.fr';
const PARAMETERS = array( array(
'category' => array(
- 'name' => 'category',
+ 'name' => 'Emission',
'type' => 'list',
- 'exampleValue' => 'Faux Raccord',
- 'title' => 'Select your category',
+ 'title' => 'Sélectionner l\'emission',
'values' => array(
'Faux Raccord' => 'faux-raccord',
- 'Top 5' => 'top-5',
- 'Tueurs en Séries' => 'tueurs-en-serie'
+ 'Fanzone' => 'fanzone',
+ 'Game In Ciné' => 'game-in-cine',
+ 'Pour la faire courte' => 'pour-la-faire-courte',
+ 'Home Cinéma' => 'home-cinema',
+ 'PILS - Par Ici Les Sorties' => 'pils-par-ici-les-sorties',
+ 'AlloCiné : l\'émission, sur LeStream' => 'allocine-lemission-sur-lestream',
+ 'Give Me Five' => 'give-me-five',
+ 'Aviez-vous remarqué ?' => 'aviez-vous-remarque',
+ 'Et paf, il est mort' => 'et-paf-il-est-mort',
+ 'The Big Fan Theory' => 'the-big-fan-theory',
+ 'Clichés' => 'cliches',
+ 'Complètement...' => 'completement',
+ '#Fun Facts' => 'fun-facts',
+ 'Origin Story' => 'origin-story',
)
)
));
@@ -23,19 +34,30 @@ class AllocineFRBridge extends BridgeAbstract {
public function getURI(){
if(!is_null($this->getInput('category'))) {
- switch($this->getInput('category')) {
- case 'faux-raccord':
- $uri = static::URI . 'video/programme-12284/saison-32180/';
- break;
- case 'top-5':
- $uri = static::URI . 'video/programme-12299/saison-29561/';
- break;
- case 'tueurs-en-serie':
- $uri = static::URI . 'video/programme-12286/saison-22938/';
- break;
- }
+ $categories = array(
+ 'faux-raccord' => 'video/programme-12284/saison-37054/',
+ 'fanzone' => 'video/programme-12298/saison-37059/',
+ 'game-in-cine' => 'video/programme-12288/saison-22971/',
+ 'pour-la-faire-courte' => 'video/programme-20960/saison-29678/',
+ 'home-cinema' => 'video/programme-12287/saison-34703/',
+ 'pils-par-ici-les-sorties' => 'video/programme-25789/saison-37253/',
+ 'allocine-lemission-sur-lestream' => 'video/programme-25123/saison-36067/',
+ 'give-me-five' => 'video/programme-21919/saison-34518/',
+ 'aviez-vous-remarque' => 'video/programme-19518/saison-37084/',
+ 'et-paf-il-est-mort' => 'video/programme-25113/saison-36657/',
+ 'the-big-fan-theory' => 'video/programme-20403/saison-37419/',
+ 'cliches' => 'video/programme-24834/saison-35591/',
+ 'completement' => 'video/programme-23859/saison-34102/',
+ 'fun-facts' => 'video/programme-23040/saison-32686/',
+ 'origin-story' => 'video/programme-25667/saison-37041/'
+ );
- return $uri;
+ $category = $this->getInput('category');
+ if(array_key_exists($category, $categories)) {
+ return static::URI . $categories[$category];
+ } else {
+ returnClientError('Emission inconnue');
+ }
}
return parent::getURI();
@@ -63,23 +85,23 @@ class AllocineFRBridge extends BridgeAbstract {
self::PARAMETERS[$this->queriedContext]['category']['values']
);
- foreach($html->find('.media-meta-list figure.media-meta-fig') as $element) {
+ foreach($html->find('div[class=gd-col-left]', 0)->find('div[class*=video-card]') as $element) {
$item = array();
- $title = $element->find('div.titlebar h3.title a', 0);
- $content = trim($element->innertext);
- $figCaption = strpos($content, $category);
+ $title = $element->find('a[class*=meta-title-link]', 0);
+ $content = trim($element->outertext);
- if($figCaption !== false) {
- $content = str_replace('src="/', 'src="' . static::URI, $content);
- $content = str_replace('href="/', 'href="' . static::URI, $content);
- $content = str_replace('src=\'/', 'src=\'' . static::URI, $content);
- $content = str_replace('href=\'/', 'href=\'' . static::URI, $content);
- $item['content'] = $content;
- $item['title'] = trim($title->innertext);
- $item['uri'] = static::URI . $title->href;
- $this->items[] = $item;
- }
+ // Replace image 'src' with the one in 'data-src'
+ $content = preg_replace('@src="data:image/gif;base64,[A-Za-z0-9+\/]*"@', '', $content);
+ $content = preg_replace('@data-src=@', 'src=', $content);
+
+ // Remove date in the content to prevent content update while the video is getting older
+ $content = preg_replace('@
' - . $finish_name . ' ' . $serie . '
'; - $item['content'] .= '' + . $finish_name . ' ' . $serie . '
'; + $item['content'] .= '{$image_html}+
{$media_html}
{$cleanedQuotedTweet}-
{$quotedImage_html}-
' + . $app['Overview'] + . '
'; + + if(array_key_exists('Project', $app)) + $item['uri'] = $app['Project']; + + if(array_key_exists('Registry', $app)) + $item['content'] .= '') + { + $markup = $trimmedMarkup; + $markup = substr($markup, 3); + + $position = strpos($markup, "
"); + + $markup = substr_replace($markup, '', $position, 4); + } + + return $markup; + } + + # + # Deprecated Methods + # + + function parse($text) + { + $markup = $this->text($text); + + return $markup; + } + + protected function sanitiseElement(array $Element) + { + static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; + static $safeUrlNameToAtt = array( + 'a' => 'href', + 'img' => 'src', + ); + + if (isset($safeUrlNameToAtt[$Element['name']])) + { + $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); + } + + if ( ! empty($Element['attributes'])) + { + foreach ($Element['attributes'] as $att => $val) + { + # filter out badly parsed attribute + if ( ! preg_match($goodAttribute, $att)) + { + unset($Element['attributes'][$att]); + } + # dump onevent attribute + elseif (self::striAtStart($att, 'on')) + { + unset($Element['attributes'][$att]); + } + } + } + + return $Element; + } + + protected function filterUnsafeUrlInAttribute(array $Element, $attribute) + { + foreach ($this->safeLinksWhitelist as $scheme) + { + if (self::striAtStart($Element['attributes'][$attribute], $scheme)) + { + return $Element; + } + } + + $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]); + + return $Element; + } + + # + # Static Methods + # + + protected static function escape($text, $allowQuotes = false) + { + return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8'); + } + + protected static function striAtStart($string, $needle) + { + $len = strlen($needle); + + if ($len > strlen($string)) + { + return false; + } + else + { + return strtolower(substr($string, 0, $len)) === strtolower($needle); + } + } + + static function instance($name = 'default') + { + if (isset(self::$instances[$name])) + { + return self::$instances[$name]; + } + + $instance = new static(); + + self::$instances[$name] = $instance; + + return $instance; + } + + private static $instances = array(); + + # + # Fields + # + + protected $DefinitionData; + + # + # Read-Only + + protected $specialCharacters = array( + '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', + ); + + protected $StrongRegex = array( + '*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', + '_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us', + ); + + protected $EmRegex = array( + '*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', + '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us', + ); + + protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?'; + + protected $voidElements = array( + 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', + ); + + protected $textLevelElements = array( + 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', + 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', + 'i', 'rp', 'del', 'code', 'strike', 'marquee', + 'q', 'rt', 'ins', 'font', 'strong', + 's', 'tt', 'kbd', 'mark', + 'u', 'xm', 'sub', 'nobr', + 'sup', 'ruby', + 'var', 'span', + 'wbr', 'time', + ); +}