Ignore:
Timestamp:
Aug 26, 2018, 8:53:55 PM (6 years ago)
Author:
chronos
Message:
  • Fixed: Updated parsing of Astra website.
  • Fixed: Correctly parse Amblar date.
  • Added: Allow to update only one meet source by specified id.
  • Added: Show RSS link with RSS icon under meet table.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Import/AstraPraha.php

    r8 r11  
    55  function Import()
    66  {
    7     echo('Parsing '.$this->Name.'...</br>');
     7    parent::Import();
    88    $Content = file_get_contents($this->URL);
    9     $Content = RemoveHtmlComments($Content);
    109
    11     $BlockStart = '----------------------------------------------';
    12     $BlockEnd = '<script type="text/javascript"';
     10    $BlockStart = '<h2>Tanečního partnera hledají:</h2>';
     11    $BlockEnd = '<hr />';
    1312    $Content = GetTextBetween($Content, $BlockStart, $BlockEnd);
    1413    if ($Content == '')
     
    1817    }
    1918
    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\' />';
    2221    while (strpos($Content, $ItemStart) !== false)
    2322    {
    2423      $Item = GetTextBetween($Content, $ItemStart, $ItemEnd);
    2524      $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>'));
    2729      if ($MeetItem->Gender == 'Hledám partnerku') $MeetItem->Gender = Gender::Male;
    2830        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>'));
    3833      $MeetItem->Name = '';
    3934      $MeetItem->Age = GetAgeFromText($MeetItem->Message);
     
    4439      $MeetItem->Database = $this->Database;
    4540      $MeetItem->Source = $this->Id;
    46       $MeetItem->AddIfNotExist();
     41      $this->AddedCount += $MeetItem->AddIfNotExist();
    4742    }
    4843  }
Note: See TracChangeset for help on using the changeset viewer.