mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
filter "private" kwdict entries
This commit is contained in:
parent
61741d7333
commit
89ee8cd7e4
@ -119,7 +119,7 @@ class FlickrAlbumExtractor(FlickrExtractor):
|
||||
}),
|
||||
("https://www.flickr.com/photos/shona_s/albums", {
|
||||
"url": "657d541470482e0d69deec33ab97a6d7d4af6fe4",
|
||||
"keyword": "ef654bfbc4ce7b74ad74e7d772e5466285ffc581",
|
||||
"keyword": "736a41a7d702f7fe00edc957ae201d84f745e654",
|
||||
}),
|
||||
)
|
||||
|
||||
|
@ -99,7 +99,7 @@ class XvideosUserExtractor(XvideosExtractor):
|
||||
test = (
|
||||
("https://www.xvideos.com/profiles/pervertedcouple", {
|
||||
"url": "a413f3e60d6d3a2de79bd44fa3b7a9c03db4336e",
|
||||
"keyword": "ef941489354fd8f4754c8a87cffd5e2429a6387c",
|
||||
"keyword": "a796760d34732adc7ec52a8feb057515209a2ca6",
|
||||
}),
|
||||
("https://www.xvideos.com/profiles/niwehrwhernvh", {
|
||||
"exception": exception.NotFoundError,
|
||||
|
@ -170,6 +170,11 @@ class Job():
|
||||
if self.ulog:
|
||||
self.ulog.info(url)
|
||||
|
||||
@staticmethod
|
||||
def _filter(kwdict):
|
||||
"""Return a copy of 'kwdict' without "private" entries"""
|
||||
return {k: v for k, v in kwdict.items() if k[0] != "_"}
|
||||
|
||||
|
||||
class DownloadJob(Job):
|
||||
"""Download images into appropriate directory/filename locations"""
|
||||
@ -516,8 +521,9 @@ class TestJob(DownloadJob):
|
||||
|
||||
def update_keyword(self, kwdict, to_list=True):
|
||||
"""Update the keyword hash"""
|
||||
kwdict = self._filter(kwdict)
|
||||
if to_list:
|
||||
self.list_keyword.append(kwdict.copy())
|
||||
self.list_keyword.append(kwdict)
|
||||
self.hash_keyword.update(
|
||||
json.dumps(kwdict, sort_keys=True, default=str).encode())
|
||||
|
||||
@ -566,17 +572,17 @@ class DataJob(Job):
|
||||
)
|
||||
self.file.write("\n")
|
||||
|
||||
def handle_url(self, url, keywords):
|
||||
self.data.append((Message.Url, url, keywords.copy()))
|
||||
def handle_url(self, url, kwdict):
|
||||
self.data.append((Message.Url, url, self._filter(kwdict)))
|
||||
|
||||
def handle_urllist(self, urls, keywords):
|
||||
self.data.append((Message.Urllist, list(urls), keywords.copy()))
|
||||
def handle_urllist(self, urls, kwdict):
|
||||
self.data.append((Message.Urllist, list(urls), self._filter(kwdict)))
|
||||
|
||||
def handle_directory(self, keywords):
|
||||
self.data.append((Message.Directory, keywords.copy()))
|
||||
def handle_directory(self, kwdict):
|
||||
self.data.append((Message.Directory, self._filter(kwdict)))
|
||||
|
||||
def handle_queue(self, url, keywords):
|
||||
self.data.append((Message.Queue, url, keywords.copy()))
|
||||
def handle_queue(self, url, kwdict):
|
||||
self.data.append((Message.Queue, url, self._filter(kwdict)))
|
||||
|
||||
def handle_finalize(self):
|
||||
self.file.close()
|
||||
|
Loading…
Reference in New Issue
Block a user