summaryrefslogtreecommitdiff
path: root/config/services/web/rss/DeutschLernenDeutscheWelleBridge.php
blob: 6d12d25e9f3ec3bb6779e00d88e5b5820a316a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

class DeutschLernenDeutscheWelleBridge extends XPathAbstract {
    const NAME = 'Deutsche Welle Lernen Bridge';
    const URI = 'https://learngerman.dw.com/de/';
    const DESCRIPTION = 'Cost-free German-learning material';
    const MAINTAINER = 'Quentin Aristote';
    const CACHE_TIMEOUT = 86400; // 24h

    const PARAMETERS = [
        '' => [
            'id' => [
                'name' => 'Identifier',
                'type' => 'text',
                'description' => 'An identifier of the shape [a-z]-[0-9]*. Found at the end of the target URL.',
                'exampleValue' => 's-60040484'
            ]
        ]
    ];

    const XPATH_EXPRESSION_ITEM = '//div[@class="teaser-wrap"]/a';
    const XPATH_EXPRESSION_ITEM_TITLE = './@title';
    const XPATH_EXPRESSION_ITEM_URI = './@href';
    // not given
    // const XPATH_EXPRESSION_ITEM_AUTHOR =
    const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/time/@datetime';
    // requires javascript
    // const XPATH_EXPRESSION_ITEM_ENCLOSURES = './figure/img[2]/@src';
    const XPATH_EXPRESSION_ITEM_CATEGORIES = './div[2]/span[1]/text()';


    public function getIcon() {
        return 'https://learngerman.dw.com/favicon.png';
    }

    public function getSourceUrl() {
        return self::URI . $this->getInput('id');
    }
}