-
Notifications
You must be signed in to change notification settings - Fork 1k
/
TheYeteeBridge.php
41 lines (31 loc) · 1.14 KB
/
TheYeteeBridge.php
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
40
41
<?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.');
$div = $html->find('.hero-col');
foreach($div as $element) {
$item = array();
$item['enclosures'] = array();
$title = $element->find('h2', 0)->plaintext;
$item['title'] = $title;
$author = trim($element->find('div[class=credit]', 0)->plaintext);
$item['author'] = $author;
$uri = $element->find('div[class=controls] a', 0)->href;
$item['uri'] = static::URI.$uri;
$content = '<p>'.$element->find('section[class=product-listing-info] p', -1)->plaintext.'</p>';
$photos = $element->find('a[class=js-modaal-gallery] img');
foreach($photos as $photo) {
$content = $content."<br /><img src='$photo->src' />";
$item['enclosures'][] = $photo->src;
}
$item['content'] = $content;
$this->items[] = $item;
}
}
}