From 03794addaf69fe7c02eb6c95142948b5e965335f Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Sun, 6 Jun 2021 16:29:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B8=D0=B7=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vkdumper.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/vkdumper.py b/vkdumper.py index 7035af8..121fa00 100755 --- a/vkdumper.py +++ b/vkdumper.py @@ -20,6 +20,7 @@ import io import os import re +import time import click import vk_api import datetime @@ -30,7 +31,6 @@ from progressbar import * ############################################################################ - class Color: GRAY = '\033[1;47m' GREEN = '\033[1;32m' @@ -240,8 +240,8 @@ class Album(object): @staticmethod def _largest_photo(photo): - max_size = sorted([p['type'] for p in photo['sizes']])[-1] - return list(filter(lambda p: p['type'] == max_size, photo['sizes']))[0]['url'] + max_size = sorted([p['width'] for p in photo['sizes']])[-1] + return list(filter(lambda p: p['width'] == max_size, photo['sizes']))[0]['url'] def archive(self, directory): img_directory = os.path.join(directory, self.title) @@ -305,13 +305,13 @@ class Photo(object): @staticmethod def _get_thumbnail(photo): - min_size = sorted([p['type'] for p in photo['sizes']])[0] - return list(filter(lambda p: p['type'] == min_size, photo['sizes']))[0]['url'] + min_size = sorted([p['width'] for p in photo['sizes']])[0] + return list(filter(lambda p: p['width'] == min_size, photo['sizes']))[0]['url'] @staticmethod def _largest_photo(photo): - max_size = sorted([p['type'] for p in photo['sizes']])[-1] - return list(filter(lambda p: p['type'] == max_size, photo['sizes']))[0]['url'] + max_size = sorted([p['width'] for p in photo['sizes']])[-1] + return list(filter(lambda p: p['width'] == max_size, photo['sizes']))[0]['url'] def archive(self, directory, date, num): img_directory = os.path.join(directory, date + " - Фотографии") @@ -341,8 +341,8 @@ class Link(object): @staticmethod def _get_thumbnail(photo): - min_size = sorted([p['type'] for p in photo['sizes']])[0] - return list(filter(lambda p: p['type'] == min_size, photo['sizes']))[0]['url'] + min_size = sorted([p['width'] for p in photo['sizes']])[0] + return list(filter(lambda p: p['width'] == min_size, photo['sizes']))[0]['url'] class Post(object): @@ -538,4 +538,8 @@ def dump(user, password, group_url, directory): if __name__ == '__main__': + # Dump vk data with Moscow timestamps + os.environ['TZ'] = 'Europe/Moscow' + time.tzset() + dump()