Changeset 11 for trunk/Import/AstraPraha.php
- Timestamp:
- Aug 26, 2018, 8:53:55 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Import/AstraPraha.php
r8 r11 5 5 function Import() 6 6 { 7 echo('Parsing '.$this->Name.'...</br>');7 parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 $Content = RemoveHtmlComments($Content);10 9 11 $BlockStart = ' ----------------------------------------------';12 $BlockEnd = '< script type="text/javascript"';10 $BlockStart = '<h2>Tanečního partnera hledají:</h2>'; 11 $BlockEnd = '<hr />'; 13 12 $Content = GetTextBetween($Content, $BlockStart, $BlockEnd); 14 13 if ($Content == '') … … 18 17 } 19 18 20 $ItemStart = '< /div><h2></h2>';21 $ItemEnd = '< div class="clearer"></div><div class="clearer">';19 $ItemStart = '<p class=\'dating-date\'>'; 20 $ItemEnd = '<hr class=\'dating-spacer\' />'; 22 21 while (strpos($Content, $ItemStart) !== false) 23 22 { 24 23 $Item = GetTextBetween($Content, $ItemStart, $ItemEnd); 25 24 $MeetItem = new MeetItem(); 26 $MeetItem->Gender = trim(GetTextBetween($Item, ');"><u>', '</u>')); 25 $MeetItem->Date = trim(GetTextBetween($Item, 'Vloženo:', '</p>')); 26 $MeetItem->Date = HumanDateToTime($MeetItem->Date); 27 28 $MeetItem->Gender = trim(GetTextBetween($Item, '<h3 class=\'dating-heading\'>', '</h3>')); 27 29 if ($MeetItem->Gender == 'Hledám partnerku') $MeetItem->Gender = Gender::Male; 28 30 else $MeetItem->Gender = Gender::Female; 29 $End = '<em>'; 30 $MeetItem->Message = trim(substr($Item, 0, strpos($Item, $End))); 31 $Item = substr($Item, strpos($Item, $End) + strlen($End)); 32 $MeetItem->Message = trim(strip_tags($MeetItem->Message)); 33 $MeetItem->Date = trim(GetTextBetween($Item, 'datum vložení', '</em>')); 34 if (substr($MeetItem->Date, 0, 1) == ':') 35 $MeetItem->Date = trim(substr($MeetItem->Date, 1)); 36 $MeetItem->Date = HumanDateToTime($MeetItem->Date); 37 $MeetItem->Email = GetEmailFromText($MeetItem->Message); 31 $MeetItem->Message = trim(GetTextBetween($Item, '<p class=\'last-element\'>', '</p>')); 32 $MeetItem->Email = trim(GetTextBetween($Item, 'class="nowrap text-link">', '</a>')); 38 33 $MeetItem->Name = ''; 39 34 $MeetItem->Age = GetAgeFromText($MeetItem->Message); … … 44 39 $MeetItem->Database = $this->Database; 45 40 $MeetItem->Source = $this->Id; 46 $ MeetItem->AddIfNotExist();41 $this->AddedCount += $MeetItem->AddIfNotExist(); 47 42 } 48 43 }
Note:
See TracChangeset
for help on using the changeset viewer.