diff --git a/bridges/RTBFBridge.php b/bridges/RTBFBridge.php
index 6097dcfc..cee0f0e9 100644
--- a/bridges/RTBFBridge.php
+++ b/bridges/RTBFBridge.php
@@ -1,7 +1,7 @@
getInput('c')) {
- $html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$this->getInput('c')) or $this->returnServerError('Could not request RTBF.');
+ $html = $this->getSimpleHTMLDOM($this->getURI())
+ or $this->returnServerError('Could not request RTBF.');
- foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
- if($count < $limit) {
- $item = array();
- $item['id'] = $element->getAttribute('data-id');
- $item['uri'] = 'http://www.rtbf.be/auvio/detail?id='.$item['id'];
- $thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
- $thumbnailUriLastSrc = end($thumbnailUriSrcSet);
- $thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
- $item['title'] = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext);
- $item['timestamp'] = strtotime($element->find('time', 0)->getAttribute('datetime'));
- $item['content'] = '';
- $this->items[] = $item;
- $count++;
- }
- }
- }
- else {
- $this->returnClientError('You must specify a series id.');
+ foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
+ if($count >= $limit) {
+ break;
+ }
+ $item = array();
+ $item['id'] = $element->getAttribute('data-id');
+ $item['uri'] = $this->uri.'detail?id='.$item['id'];
+ $thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset'));
+ $thumbnailUriLastSrc = end($thumbnailUriSrcSet);
+ $thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0];
+ $item['title'] = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext);
+ $item['timestamp'] = strtotime($element->find('time', 0)->getAttribute('datetime'));
+ $item['content'] = '';
+ $this->items[] = $item;
+ $count++;
}
}
+ public function getURI(){
+ return $this->uri.'detail?id='.$this->getInput('c');
+ }
+
public function getName(){
- return (!empty($this->request) ? $this->request .' - ' : '') .'RTBF Bridge';
+ return $this->getInput('c') .' - RTBF Bridge';
}
public function getCacheDuration(){