-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf_nationalgeographic.php
56 lines (39 loc) · 1.36 KB
/
conf_nationalgeographic.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
class config
{
public static $baseUrl = 'http://photography.nationalgeographic.com/photography/photo-of-the-day/';
public static $filters = array(
'pics' => array(
'content_Main div' => array(
'regex' => '%content_mainA(.*)content_mainA%sm',
),
# 'blaaa' => array(
# 'regex' => '°°',
# )
)
);
/*
*
Idee: Eine Art Makefile machen
Man definiert eine Menge von Regeln (Eine Regel ist zum Beispiel ein Regex
und anschließend, in welcher Reihenfolge die anzuwenden sind.
start => get_url ...
contentmainA => regex ...
contentmainText => regex
contentmainPic => if content.
content => make start,contentmainA
content.hasbigpic => make start,contentmainA
text => make content,contentmainText
pic => make contentcontentmainPic
... hm, das muss wohl noch trickier werden...
*/
public static function pics($content)
{
$sxml = new SimpleXMLElement($content);
$results = $sxml->xpath(".//*[@id='content_mainA']/div[1]/div/div[1]/div[2]/a");
return $results;
}
}
#
# <div class="download_link"><a href="http://images.nationalgeographic.com/wpf/media-live/photos/000/600/custom/60072_1600x1200-wallpaper-cb1349989057.jpg">Download Wallpaper (1600 x 1200 pixels)</a></div>
#