1 | <?php
|
---|
2 |
|
---|
3 | class MeetSourceLaTropical extends MeetSource
|
---|
4 | {
|
---|
5 | function Import(): string
|
---|
6 | {
|
---|
7 | $Output = parent::Import();
|
---|
8 | $this->AddCompareTime = false;
|
---|
9 | $this->AddCompareRemoteId = true;
|
---|
10 | $Content = file_get_contents($this->URL);
|
---|
11 |
|
---|
12 | $BlockStart = '<div class="views-element-container" id="block-views-inzeraty">';
|
---|
13 | $BlockEnd = '</section>';
|
---|
14 | $Content = GetTextBetween($Content, $BlockStart, $BlockEnd);
|
---|
15 | if ($Content == '')
|
---|
16 | {
|
---|
17 | $Output .= 'Main block not isolated.</br>';
|
---|
18 | return $Output;
|
---|
19 | }
|
---|
20 |
|
---|
21 | $ItemStart = '<div class="container">';
|
---|
22 | $ItemEnd = "</div></span></div>";
|
---|
23 | while (strpos($Content, $ItemStart) !== false)
|
---|
24 | {
|
---|
25 | $Item = GetTextBetween($Content, $ItemStart, $ItemEnd);
|
---|
26 | $MeetItem = new MeetItem();
|
---|
27 |
|
---|
28 | $MeetItem->Link = 'https://latropical.cz'.trim(GetTextBetween($Item, '<a href="', "\""));
|
---|
29 | $MeetItem->Title = trim(GetTextBetween($Item, '>', '<'));
|
---|
30 | $Date = substr(trim(strip_tags(GetTextBetween($Item, '<p>', '</p>'))), -10);
|
---|
31 | $MeetItem->Time = HumanDateToTime($Date);
|
---|
32 | $MeetItem->Message = $MeetItem->Title."\n".trim(html_entity_decode(strip_tags(GetTextBetween($Item, "<div class=\"\">", "</div>"))));
|
---|
33 | $MeetItem->Age = GetAgeFromText($MeetItem->Message);
|
---|
34 | $MeetItem->Height = GetHeightFromText($MeetItem->Message);
|
---|
35 | $MeetItem->Weight = GetWeightFromText($MeetItem->Message);
|
---|
36 | $MeetItem->Name = GetNameFromText($MeetItem->Message);
|
---|
37 | if ($MeetItem->Name != '') $MeetItem->Gender = GetGenderFromName($MeetItem->Name);
|
---|
38 | $MeetItem->Email = GetEmailFromText($MeetItem->Message);
|
---|
39 | $MeetItem->Location = GetLocationFromText($MeetItem->Message);
|
---|
40 |
|
---|
41 | $MeetItem->Database = $this->Database;
|
---|
42 | $MeetItem->Source = $this->Id;
|
---|
43 | $this->MeetItems[] = $MeetItem;
|
---|
44 | }
|
---|
45 | return $Output;
|
---|
46 | }
|
---|
47 | }
|
---|