aboutsummaryrefslogtreecommitdiff
path: root/bridges/MondeDiploBridge.php
blob: 2aad1a4cbae84a1df151d39fb88b3cd59a8b2093 (plain) (blame)
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
<?php
class MondeDiploBridge extends BridgeAbstract{

	public function loadMetadatas() {
		$this->maintainer = "Pitchoule";
		$this->name = "MondeDiplo";
		$this->uri = "http://www.monde-diplomatique.fr";
		$this->description = "Returns most recent results from MondeDiplo.";
		$this->update = "2016-08-03";
	}

	public function collectData(array $param){	
		$html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request MondeDiplo. for : ' . $link , 404);

		foreach($html->find('div.unarticle') as $article) {
			$element = $article->parent();
			$item = new Item();
			$item->uri = $this->getURI() . $element->href;
			$item->title = $element->find('h3', 0)->plaintext;
			$item->content = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
			$this->items[] = $item;
		}
	}

	public function getName(){
		return 'Monde Diplomatique';
	}

	public function getURI(){
		return 'http://www.monde-diplomatique.fr';
	}

	public function getCacheDuration(){
		return 21600; // 6 hours
	}
}