Debian Codegraph @

gallery_dl/extractor/message.py

raw
1 # -*- coding: utf-8 -*-
2
3 # Copyright 2015-2025 Mike Fährmann
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
8
9
10 class Message():
11 """Enum for message identifiers
12
13 Extractors yield their results as message-tuples, where the first element
14 is one of the following identifiers. This message-identifier determines
15 the type and meaning of the other elements in such a tuple.
16
17 - Message.Version: # obsolete
18 - Message protocol version (currently always '1')
19 - 2nd element specifies the version of all following messages as integer
20
21 - Message.Directory:
22 - Sets the target directory for all following images
23 - 2nd element is unused
24 - 3rd element is a dictionary containing general metadata
25
26 - Message.Url:
27 - Image URL and its metadata
28 - 2nd element is the URL as a string
29 - 3rd element is a dictionary with image-specific metadata
30
31 - Message.Headers: # obsolete
32 - HTTP headers to use while downloading
33 - 2nd element is a dictionary with header-name and -value pairs
34
35 - Message.Cookies: # obsolete
36 - Cookies to use while downloading
37 - 2nd element is a dictionary with cookie-name and -value pairs
38
39 - Message.Queue:
40 - (External) URL that should be handled by another extractor
41 - 2nd element is the (external) URL as a string
42 - 3rd element is a dictionary containing URL-specific metadata
43
44 - Message.Urllist: # obsolete
45 - Same as Message.Url, but its 2nd element is a list of multiple URLs
46 - The additional URLs serve as a fallback if the primary one fails
47 """
48
49 # Version = 1
50 Directory = 2
51 Url = 3
52 # Headers = 4
53 # Cookies = 5
54 Queue = 6
55 # Urllist = 7
56 # Metadata = 8