2018-09-10 22:56:55 +03:00
|
|
|
<?php
|
|
|
|
class TheYeteeBridge extends BridgeAbstract {
|
|
|
|
|
|
|
|
const MAINTAINER = 'Monsieur Poutounours';
|
|
|
|
const NAME = 'TheYetee';
|
|
|
|
const URI = 'https://theyetee.com';
|
|
|
|
const CACHE_TIMEOUT = 14400; // 4 h
|
|
|
|
const DESCRIPTION = 'Fetch daily shirts from The Yetee';
|
|
|
|
|
|
|
|
public function collectData(){
|
|
|
|
|
|
|
|
$html = getSimpleHTMLDOM(self::URI)
|
|
|
|
or returnServerError('Could not request The Yetee.');
|
|
|
|
|
2021-02-21 13:19:20 +03:00
|
|
|
$div = $html->find('.module_timed-item.is--full');
|
2018-09-10 22:56:55 +03:00
|
|
|
foreach($div as $element) {
|
|
|
|
|
|
|
|
$item = array();
|
|
|
|
$item['enclosures'] = array();
|
|
|
|
|
|
|
|
$title = $element->find('h2', 0)->plaintext;
|
|
|
|
$item['title'] = $title;
|
|
|
|
|
2021-02-21 13:19:20 +03:00
|
|
|
$author = trim($element->find('.module_timed-item--artist a', 0)->plaintext);
|
2018-09-10 22:56:55 +03:00
|
|
|
$item['author'] = $author;
|
|
|
|
|
2021-02-21 13:19:20 +03:00
|
|
|
$item['uri'] = static::URI;
|
2018-09-10 22:56:55 +03:00
|
|
|
|
2021-02-21 13:19:20 +03:00
|
|
|
$content = '<p>' . $title . ' by ' . $author . '</p>';
|
|
|
|
$photos = $element->find('a.img');
|
2018-09-10 22:56:55 +03:00
|
|
|
foreach($photos as $photo) {
|
2021-02-21 13:19:20 +03:00
|
|
|
$content = $content . "<br /><img src='$photo->href' />";
|
2018-09-10 22:56:55 +03:00
|
|
|
$item['enclosures'][] = $photo->src;
|
|
|
|
}
|
|
|
|
$item['content'] = $content;
|
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|