forked from blallo/rss-bridge
[RadioRai] NEW podcast from RadioRai (Italian)
This commit is contained in:
parent
7e082083b2
commit
fd02965fe9
1 changed files with 48 additions and 0 deletions
48
bridges/RadioRaiBridge.php
Normal file
48
bridges/RadioRaiBridge.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
class RadioRaiBridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = 'boyska';
|
||||
const NAME = 'Radio Rai';
|
||||
const URI = 'https://www.raiplayradio.it';
|
||||
const CACHE_TIMEOUT = 1; // 10min
|
||||
const DESCRIPTION = 'Segui le trasmissioni radio rai con feed/podcast valido';
|
||||
const PARAMETERS = array( array(
|
||||
'txname' => array(
|
||||
'name' => 'txname',
|
||||
'required' => true
|
||||
)
|
||||
));
|
||||
|
||||
public function collectData(){
|
||||
$html = getSimpleHTMLDOM($this->getURI())
|
||||
or returnServerError('No results for this query.');
|
||||
|
||||
foreach($html->find('[data-mediapolis]') as $episode) {
|
||||
// var_dump($episode);
|
||||
|
||||
$title = $episode->getAttribute('data-title');
|
||||
if($title === FALSE) { continue; }
|
||||
$audiourl = $episode->getAttribute('data-mediapolis');
|
||||
$item = array();
|
||||
$item['author'] = $this->getInput('txname');
|
||||
$item['title'] = $title;
|
||||
$item['content'] = $episode->plaintext;
|
||||
$item['enclosures'] = [ $audiourl ];
|
||||
$item['url'] = $this::URI . $episode->getAttribute('data-href');
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
return 'https://www.raiplayradio.it/programmi/' . $this->getInput('txname') . '/archivio/puntate/';
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if($this->getInput('txname')) {
|
||||
return 'Radio Rai - ' . $this->getInput('txname');
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue