add 'text.parse_float()' + cleanup in text.py

This commit is contained in:
Mike Fährmann
2019-01-29 13:14:30 +01:00
parent 0c32dc5858
commit 2d2953a5bf
4 changed files with 46 additions and 15 deletions

View File

@@ -103,7 +103,7 @@ class BehanceGalleryExtractor(BehanceExtractor):
"gallery_id": text.parse_int(self.gallery_id),
"title": text.unescape(title or ""),
"user": ", ".join(users),
"fields": [f for f in text.split_html(fields) if f != ", "],
"fields": [f for f in text.split_html(fields) if f != ","],
"date": text.parse_int(date),
"views": text.parse_int(stats[0]),
"votes": text.parse_int(stats[1]),

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2018 Mike Fährmann
# Copyright 2014-2019 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -88,7 +88,7 @@ class SankakuExtractor(SharedConfigExtractor):
"id": text.parse_int(post_id),
"md5": file_url.rpartition("/")[2].partition(".")[0],
"tags": text.unescape(tags),
"vote_average": float(vavg or 0),
"vote_average": text.parse_float(vavg),
"vote_count": text.parse_int(vcnt),
"created_at": created,
"rating": (rating or "?")[0].lower(),