This commit is contained in:
parent
cd920a0c85
commit
38936026ea
@ -108,13 +108,13 @@ def link_exist_in_db(href):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def parse_date(str_to_parse):
|
def parse_date(str_to_parse, date_format=''):
|
||||||
if str_to_parse is None:
|
if str_to_parse is None:
|
||||||
return datetime.fromtimestamp(0)
|
return datetime.fromtimestamp(0)
|
||||||
elif isinstance(str_to_parse, datetime):
|
elif isinstance(str_to_parse, datetime):
|
||||||
return str_to_parse
|
return str_to_parse
|
||||||
else:
|
else:
|
||||||
date = parse(str_to_parse)
|
date = parse(str_to_parse, date_formats=[date_format])
|
||||||
if date:
|
if date:
|
||||||
return date
|
return date
|
||||||
else:
|
else:
|
||||||
@ -265,7 +265,7 @@ class Nyaa(Connector):
|
|||||||
'link': tds[2].decode_contents().replace('/download/',
|
'link': tds[2].decode_contents().replace('/download/',
|
||||||
'%s%s' % (self.base_url, '/download/')),
|
'%s%s' % (self.base_url, '/download/')),
|
||||||
'size': tds[3].string,
|
'size': tds[3].string,
|
||||||
'date': parse_date(tds[4].string),
|
'date': parse_date(tds[4].string, '%Y-%m-%d %H:%M'),
|
||||||
'seeds': check_seeds,
|
'seeds': check_seeds,
|
||||||
'leechs': tds[6].string,
|
'leechs': tds[6].string,
|
||||||
'downloads': check_downloads,
|
'downloads': check_downloads,
|
||||||
@ -329,7 +329,7 @@ class Pantsu(Connector):
|
|||||||
'link': tds[2].decode_contents().replace('icon-magnet', 'fa fa-fw fa-magnet').replace(
|
'link': tds[2].decode_contents().replace('icon-magnet', 'fa fa-fw fa-magnet').replace(
|
||||||
'icon-floppy', 'fa fa-fw fa-download'),
|
'icon-floppy', 'fa fa-fw fa-download'),
|
||||||
'size': tds[3].string,
|
'size': tds[3].string,
|
||||||
'date': parse_date(tds[7]['title'][:-6]),
|
'date': parse_date(tds[7]['title'][:-6], '%m/%d/%Y, %I:%M:%S %p'),
|
||||||
'seeds': check_seeds,
|
'seeds': check_seeds,
|
||||||
'leechs': tds[5].string,
|
'leechs': tds[5].string,
|
||||||
'downloads': check_downloads,
|
'downloads': check_downloads,
|
||||||
@ -506,7 +506,7 @@ class AnimeUltime(Connector):
|
|||||||
'href': '%s/%s' % (self.base_url, link['href']),
|
'href': '%s/%s' % (self.base_url, link['href']),
|
||||||
'name': link.string,
|
'name': link.string,
|
||||||
'type': tds[4].string,
|
'type': tds[4].string,
|
||||||
'date': parse_date(h3s[i].string[:-3]),
|
'date': parse_date(h3s[i].string[:-3], '%A %d %B %Y'),
|
||||||
'class': self.color if link_exist_in_db(href) else ''
|
'class': self.color if link_exist_in_db(href) else ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user