Changeset 37 for trunk/Modules/Meet/Import/Seznamka.php
- Timestamp:
- May 5, 2019, 5:17:06 PM (6 years ago)
- Location:
- trunk/Modules
- Files:
-
- 2 added
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Meet/Import/Seznamka.php
r32 r37 5 5 function Import() 6 6 { 7 parent::Import();7 $Output = parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 $BlockStart = ' Tanec ...</h1 class=\'nadpis\'>';10 $BlockEnd = '< !--';9 $BlockStart = '<h1>Tanec ... : Seznamka</h1>'; 10 $BlockEnd = '<h2>Doporučujeme</h2>'; 11 11 //echo($Content); 12 12 $Content = GetTextBetween($Content, $BlockStart, $BlockEnd); 13 13 if ($Content == '') 14 14 { 15 echo('Main block not isolated.</br>');16 return ;15 $Output .= 'Main block not isolated.</br>'; 16 return $Output; 17 17 } 18 18 19 $ItemStart = '<div class=\' inztop\'>';19 $ItemStart = '<div class=\'col-xs-12\'>'; 20 20 $ItemEnd = 'Odpovědět</a></div></div></div>'; 21 21 while (strpos($Content, $ItemStart) !== false) 22 22 { 23 23 $Item = GetTextBetween($Content, $ItemStart, $ItemEnd); 24 if ($Item == '') break; 24 25 $MeetItem = new MeetItem(); 25 26 //$MeetItem->Image = trim(GetTextBetween($Item, '<div', '</div>')); 26 if (strpos($Item, "return false\" class='") !== false) 27 { 28 $MeetItem->Gender = trim(GetTextBetween($Item, "return false\" class='", "'")); 29 } else 30 { 31 $MeetItem->Gender = trim(GetTextBetween($Item, '<span class="ipoh ', '"')); 32 } 27 $MeetItem->Gender = trim(GetTextBetween($Item, "<span class=\"ipoh ", "\"")); 33 28 if ($MeetItem->Gender == 'zena') $MeetItem->Gender = Gender::Female; 34 else if ($MeetItem->Gender == 'muz') $MeetItem->Gender = Gender::Male;35 else $MeetItem->Gender = Gender::Undefined;29 else if ($MeetItem->Gender == 'muz') $MeetItem->Gender = Gender::Male; 30 else $MeetItem->Gender = Gender::Undefined; 36 31 $MeetItem->Name = trim(GetTextBetween($Item, '>', '</span>')); 37 32 $MeetItem->Name = trim(strip_tags($MeetItem->Name)); 38 $Category = trim(GetTextBetween($Item, ' rel="nofollow">', '</a></span>'));39 $MeetItem->Age = trim(GetTextBetween($Item, ' rel="nofollow">', '</a></span>'));33 $Category = trim(GetTextBetween($Item, '" >', '</a>')); 34 $MeetItem->Age = trim(GetTextBetween($Item, '" >', '</a>')); 40 35 $MeetItem->Age = trim(str_replace('let', '', $MeetItem->Age)); 41 $MeetItem->Location = trim(GetTextBetween($Item, ' rel="nofollow">', '</a></span>')); 42 $MeetItem->Time = HumanDateToTime(trim(GetTextBetween($Item, '> </a>', '</span>'))); 43 $MeetItem->Message = trim(strip_tags(GetTextBetween($Item, 'margin-top:10px;\'>', '</div>'))); 36 $MeetItem->Location = trim(GetTextBetween($Item, '" >', '</a>')); 37 $MeetItem->Time = trim(GetTextBetween($Item, 'TOP</a> ', '</span>')); 38 if ($MeetItem->Time == 'Včera') $MeetItem->Time = HumanDate(time() - 60*60*24); 39 else if ($MeetItem->Time == 'Dnes') $MeetItem->Time = HumanDate(time()); 40 $MeetItem->Time = HumanDateToTime($MeetItem->Time); 41 $MeetItem->Message = trim(strip_tags(GetTextBetween($Item, '<p>', '</p>'))); 44 42 $MeetItem->Link = GetTextBetween($Item, "<a href='", "'"); 45 43 while (substr($MeetItem->Link, 0, 3) == '../') … … 54 52 $this->AddedCount += $MeetItem->AddIfNotExist(); 55 53 } 54 return $Output; 56 55 } 57 56 }
Note:
See TracChangeset
for help on using the changeset viewer.