-
Notifications
You must be signed in to change notification settings - Fork 3
/
settings.py-example
96 lines (81 loc) · 3.63 KB
/
settings.py-example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# -*- coding: utf-8 -*-
# vim: set noai noexpandtab sts=0:
import locale
from urllib.parse import urlparse
# Note: There are settings in `wishlist.xslt` too!
##
## Edit your wishlists settings:
##
# Specify which products will be considered on-budget.
# These are just defaults differentiated by product priority.
#
# NOTE: You can override this for individual products by having something
# like "{if $80.50}" or "{ab 5,10 Euro}" or "{12}" or "{yAdda 55.42 yaDdA}"
# somewhere in a product comment on your Amazon wishlist,
# In comments, use a price number format according to your locale.
#
# Specifying a price below 0 means never on budget (can be used for exclusion).
# The XML output-file, however, will contain all products but annotated
# with a negative buy-price. The viewer, however, hides such products.
#
WISHLISTS_BUYPRICES = {
# Pty : Price # Priority name on Amazon:
-2 : -1, # "Don't buy this for me"
-1 : -1, # ""
0 : 10.0, # "Normal"
1 : 15.0, # ""
2 : 20.0 # "Must have"
}
# 2023-06-01: Amazon no longer displays all listnames to non-authenticated users, just items.
# So we have to reverse logic from explict exclusion with all lists being loaded by default
# to explicit inclusion of lists which is usually more laborsome to users
# and error-prone in terms of missing/forgetting to add new list here over time.
#
# To get all URLs at once, I visit one of my wishlists in my Chrome browser
# and use Chrome's Devtools console:
# 1. Type and press enter:
# > Array.from( document.querySelectorAll( '.wl-list a' )).map( x => [ x.href.split( '?' )[0], x.querySelector( '[id^="wl-list-entry-title"]' ).textContent.trim() ])
# 2. Right-click on the console output "Array(2),Array(2),..." and select "copy object"
# 3. Paste here between brackets of WISHLISTS = [ ... ]
# 4. Optionally search-replace "]," to "],\r" (newlines in Vim)
# and comment out excluded lists
#
WISHLISTS = [
[ 'https://www.amazon.de/hz/wishlist/ls/EXAMPLE1/', 'My list 1' ],
[ 'https://www.amazon.de/hz/wishlist/ls/EXAMPLE2/', 'My list 2' ],
]
# Names of the exported files.
# Default: './wishlist.xml'
#
WISHLISTS_XMLPATH = './wishlist.xml'
#
# Filename of the HTML report (or any other XSLT product).
# If you change the name, you have to rename wishlist.xslt accordingly.
# Rename if you want to use a custom XSLT-file which is not overwritten
# by the very next program update. Your custom XSLT-file can also link
# a custom CSS-file other than 'wishlist.css'.
# Default: './wishlist.html'
#
WISHLISTS_XSLOUTPATH = './wishlist.html'
##
## Edit your localization settings:
##
DEFAULT_REQUEST_HEADERS = { 'Accept-Language': 'de' } # RFC 5646 language tags: 'de', 'en', ...
locale.setlocale( locale.LC_ALL, 'de_DE.UTF-8' ) # Locale values: 'de_DE.UTF-8', 'en_US.UTF-8', 'en_GB.UTF-8', ...
AMAZON_HOST = urlparse( WISHLISTS_URL_ANY ).netloc # Don't change.
AMAZON_BASEURL = 'https://' + AMAZON_HOST # Don't change.
##
## You can ignore these scraper settings:
##
SCRAPY_SETTINGS = {
'USER_AGENT' : 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36',
'DOWNLOAD_DELAY' : 0.250, # Seconds
#'DOWNLOADER_MIDDLEWARES' : {
# 'scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware': None,
# 'scrapy_httpcache.downloadermiddlewares.httpcache.AsyncHttpCacheMiddleware': 900,
#},
#'HTTPCACHE_ENABLED' : True,
#'HTTPCACHE_STORAGE' : 'scrapy.extensions.httpcache.FilesystemCacheStorage',
#'HTTPCACHE_POLICY' : 'scrapy.extensions.httpcache.DummyPolicy',
#'HTTPCACHE_IGNORE_HTTP_CODES' = [301, 302, 500, 503],
}