def __too_old(self, post):
     try:
         filter_days = datetime.timedelta(days=int(kodi.get_setting('%s-filter' % (self.get_name()))))
         if filter_days:
             post_date = re.search('class="postMonth"\s+title="(\d+)[^>]*>([^<]+).*?class="postDay"[^>]*>(\d+)', post, re.DOTALL)
             year, mon_name, day = post_date.groups()
             post_date = '%s-%s-%s' % (year, SHORT_MONS.index(mon_name) + 1, day)
             post_date = scraper_utils.to_datetime(post_date, '%Y-%m-%d').date()
             if datetime.date.today() - post_date > filter_days:
                 return True
     except:
         return False
     
     return False
Beispiel #2
0
 def __too_old(self, post):
     try:
         filter_days = datetime.timedelta(days=int(kodi.get_setting('%s-filter' % (self.get_name()))))
         if filter_days:
             today = datetime.date.today()
             match = re.search('<span\s+class="date">(.*?)\s+(\d+)[^<]+(\d{4})<', post)
             mon_name, post_day, post_year = match.groups()
             post_month = SHORT_MONS.index(mon_name) + 1
             post_date = datetime.date(int(post_year), post_month, int(post_day))
             if today - post_date > filter_days:
                 return True
     except ValueError:
         return False
     
     return False
 def __too_old(self, post):
     filter_days = datetime.timedelta(days=int(kodi.get_setting('%s-filter' % (self.get_name()))))
     if filter_days:
         today = datetime.date.today()
         match = re.search('class="postMonth"\s+title="([^"]+)">([^<]+).*?class="postDay"[^>]*>([^<]+)', post)
         if match:
             try:
                 post_year, mon_name, post_day = match.groups()
                 post_month = SHORT_MONS.index(mon_name) + 1
                 post_date = datetime.date(int(post_year), post_month, int(post_day))
                 if today - post_date > filter_days:
                     return True
             except ValueError:
                 return False
     return False
 def __too_old(self, post):
     try:
         filter_days = datetime.timedelta(days=int(kodi.get_setting('%s-filter' % (self.get_name()))))
         if filter_days:
             today = datetime.date.today()
             match = re.search('<a[^>]+title="posting time[^"]*">(.*?)\s+(\d+)\s*(\d{2,4})<', post)
             mon_name, post_day, post_year = match.groups()
             post_year = int(post_year)
             if post_year < 2000: post_year += 2000
             post_month = SHORT_MONS.index(mon_name) + 1
             post_date = datetime.date(post_year, post_month, int(post_day))
             if today - post_date > filter_days:
                 return True
     except ValueError:
         return False
     
     return False
Beispiel #5
0
 def __too_old(self, post):
     try:
         filter_days = datetime.timedelta(days=int(kodi.get_setting('%s-filter' % (self.get_name()))))
         if filter_days:
             today = datetime.date.today()
             match = re.search('<a[^>]+title="posting time[^"]*">(.*?)\s+(\d+)\s*(\d{2,4})<', post)
             mon_name, post_day, post_year = match.groups()
             post_year = int(post_year)
             if post_year < 2000: post_year += 2000
             post_month = SHORT_MONS.index(mon_name) + 1
             post_date = datetime.date(post_year, post_month, int(post_day))
             if today - post_date > filter_days:
                 return True
     except ValueError:
         return False
     
     return False
Beispiel #6
0
 def __too_old(self, post):
     filter_days = datetime.timedelta(
         days=int(kodi.get_setting('%s-filter' % (self.get_name()))))
     if filter_days:
         today = datetime.date.today()
         match = re.search(
             'class="postMonth"\s+title="([^"]+)">([^<]+).*?class="postDay"[^>]*>([^<]+)',
             post)
         if match:
             try:
                 post_year, mon_name, post_day = match.groups()
                 post_month = SHORT_MONS.index(mon_name) + 1
                 post_date = datetime.date(int(post_year), post_month,
                                           int(post_day))
                 if today - post_date > filter_days:
                     return True
             except ValueError:
                 return False
     return False
    def __too_old(self, post):
        try:
            filter_days = datetime.timedelta(
                days=int(kodi.get_setting('%s-filter' % (self.get_name()))))
            if filter_days:
                post_date = re.search(
                    'class="postMonth"\s+title="(\d+)[^>]*>([^<]+).*?class="postDay"[^>]*>(\d+)',
                    post, re.DOTALL)
                year, mon_name, day = post_date.groups()
                post_date = '%s-%s-%s' % (year, SHORT_MONS.index(mon_name) + 1,
                                          day)
                post_date = scraper_utils.to_datetime(post_date,
                                                      '%Y-%m-%d').date()
                if datetime.date.today() - post_date > filter_days:
                    return True
        except:
            return False

        return False