1 | <?php
|
---|
2 |
|
---|
3 | class MeetSourceMgDance 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 = '<form method="post" action="https://www.mgdance.cz/tanecni-seznamka/prochazeni-kategorie/">';
|
---|
13 | $BlockEnd = '<table>';
|
---|
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="displayaditem';
|
---|
22 | $ItemEnd = '<div class="fixfloat"></div></div><div class="fixfloat">';
|
---|
23 | while (strpos($Content, $ItemStart) !== false)
|
---|
24 | {
|
---|
25 | $Item = GetTextBetween($Content, $ItemStart, $ItemEnd);
|
---|
26 | $MeetItem = new MeetItem();
|
---|
27 |
|
---|
28 | $MeetItem->Link = trim(GetTextBetween($Item, '<h4><a href="', '"'));
|
---|
29 | $MeetItem->Title = trim(GetTextBetween($Item, '>', '</a>'));
|
---|
30 | $MeetItem->Message = trim(GetTextBetween($Item, '</h4>', '</div>'));
|
---|
31 | $MeetItem->Location = trim(GetTextBetween($Item, '>Město: ', '<br/>'));
|
---|
32 | $MeetItem->Time = time();
|
---|
33 | $MeetItem->Database = $this->Database;
|
---|
34 | $MeetItem->Source = $this->Id;
|
---|
35 | $Output .= $this->ImportItem($MeetItem);
|
---|
36 | $this->MeetItems[] = $MeetItem;
|
---|
37 | }
|
---|
38 | return $Output;
|
---|
39 | }
|
---|
40 |
|
---|
41 | function ImportItem(MeetItem &$MeetItem): string
|
---|
42 | {
|
---|
43 | $Output = '';
|
---|
44 | $Content = file_get_contents($MeetItem->Link);
|
---|
45 |
|
---|
46 | $BlockStart = '<div id="showawpcpadpage">';
|
---|
47 | $BlockEnd = 'Odpovědět na inzerát</a>';
|
---|
48 | $Content = GetTextBetween($Content, $BlockStart, $BlockEnd);
|
---|
49 | if ($Content == '')
|
---|
50 | {
|
---|
51 | $Output .= 'Main block not isolated.</br>';
|
---|
52 | return $Output;
|
---|
53 | }
|
---|
54 |
|
---|
55 | $MeetItem->Title = trim(GetTextBetween($Content, '<div class="awpcp-title">', '</div>'));
|
---|
56 | $MeetItem->Name = trim(GetTextBetween($Content, '<br/>Jméno:', '<br/>'));
|
---|
57 | $MeetItem->Gender = GetGenderFromName($MeetItem->Name);
|
---|
58 | $MeetItem->Location = trim(GetTextBetween($Content, 'Město: ', '</div>'));
|
---|
59 | $MeetItem->Message = trim(GetTextBetween($Content, '</p>', '<p>'));
|
---|
60 | $MeetItem->Age = GetAgeFromText($MeetItem->Message);
|
---|
61 | $MeetItem->Height = GetHeightFromText($MeetItem->Message);
|
---|
62 | $MeetItem->Weight = GetWeightFromText($MeetItem->Message);
|
---|
63 | $MeetItem->Email = GetEmailFromText($MeetItem->Message);
|
---|
64 |
|
---|
65 | return $Output;
|
---|
66 | }
|
---|
67 | }
|
---|