From d0bebd9ce31685d4339c75b7bc00c5154e75e450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 3 Nov 2015 00:05:18 +0100 Subject: [PATCH] allow adding values to existing dict --- gallery_dl/text.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gallery_dl/text.py b/gallery_dl/text.py index 18f62e3f..7a9a2414 100644 --- a/gallery_dl/text.py +++ b/gallery_dl/text.py @@ -80,9 +80,10 @@ def extract(txt, begin, end, pos=0): except ValueError: return None, pos -def extract_all(txt, rules, pos=0): +def extract_all(txt, rules, pos=0, values=None): """Calls extract for each rule and returns the result in a dict""" - values = {} + if values is None: + values = {} for key, begin, end in rules: result, pos = extract(txt, begin, end, pos) if key: