[ARDMediathekBridge] New bridge (#2158)

This commit is contained in:
岳东辰 2021-07-20 17:58:50 +10:00 committed by GitHub
parent cabf7a748a
commit 3050f0ae70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?php
class ARDMediathekBridge extends BridgeAbstract {
const NAME = 'ARD-Mediathek Bridge';
const URI = 'https://www.ardmediathek.de';
const DESCRIPTION = 'Feed of any series in the ARD-Mediathek, specified by its path';
const MAINTAINER = 'yue-dongchen';
const PARAMETERS = array(
array(
'path' => array(
'name' => 'Path',
'required' => true,
'title' => 'Enter without trailing slash',
'defaultValue' => '45-min/Y3JpZDovL25kci5kZS8xMzkx'
)
)
);
public function collectData() {
date_default_timezone_set('Europe/Berlin');
$url = 'https://www.ardmediathek.de/sendung/' . $this->getInput('path') . '/';
$html = getSimpleHTMLDOM($url);
$html = defaultLinkTo($html, $url);
foreach($html->find('a.Root-sc-1ytw7qu-0') as $video) {
$item = array();
$item['uri'] = $video->href;
$item['title'] = $video->find('h3', 0)->plaintext;
$item['content'] = '<img src="' . $video->find('img', 0)->src . '" />';
$item['timestamp'] = strtotime(mb_substr($video->find('div.Line-epbftj-1', 0)->plaintext, 0, 10));
$this->items[] = $item;
}
}
}