automatic screenshots
This commit is contained in:
parent
14936a8b98
commit
e5f127045b
1
screenshot/.gitignore
vendored
Normal file
1
screenshot/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
img/*.png
|
0
screenshot/img/.gitkeep
Normal file
0
screenshot/img/.gitkeep
Normal file
44
screenshot/mk_screenshot.py
Normal file
44
screenshot/mk_screenshot.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import subprocess
|
||||||
|
|
||||||
|
"""
|
||||||
|
This script assumes that you have installed wkhtmltopdf
|
||||||
|
"""
|
||||||
|
|
||||||
|
BASE_URL = 'https://quinquina.champs-libres.be/'
|
||||||
|
|
||||||
|
"""
|
||||||
|
To get a valid cookie key/value, copy as curl a request in your browser:
|
||||||
|
|
||||||
|
curl 'https://quinquina.champs-libres.be/_wdt/708fb5' \
|
||||||
|
-H 'Connection: keep-alive' \
|
||||||
|
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"' \
|
||||||
|
-H 'X-Requested-With: XMLHttpRequest' \
|
||||||
|
-H 'sec-ch-ua-mobile: ?0' \
|
||||||
|
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36' \
|
||||||
|
-H 'sec-ch-ua-platform: "Linux"' \
|
||||||
|
-H 'Accept: */*' \
|
||||||
|
-H 'Sec-Fetch-Site: same-origin' \
|
||||||
|
-H 'Sec-Fetch-Mode: cors' \
|
||||||
|
-H 'Sec-Fetch-Dest: empty' \
|
||||||
|
-H 'Referer: https://quinquina.champs-libres.be/fr/person/household/376/relationship' \
|
||||||
|
-H 'Accept-Language: en-US,en;q=0.9' \
|
||||||
|
-H 'Cookie: PHPSESSID=57dee6deabd6e0ae75f7a55421fc2427' \
|
||||||
|
--compressed
|
||||||
|
"""
|
||||||
|
|
||||||
|
COOKIE_KEY = 'PHPSESSID'
|
||||||
|
COOKIE_VALUE = '57dee6deabd6e0ae75f7a55421fc2427'
|
||||||
|
|
||||||
|
household_id = 376
|
||||||
|
|
||||||
|
URLS = [
|
||||||
|
f'fr/person/household/{household_id}/summary',
|
||||||
|
f'fr/person/household/{household_id}/addresses',
|
||||||
|
f'fr/person/household/{household_id}/relationship'
|
||||||
|
]
|
||||||
|
|
||||||
|
for u in URLS:
|
||||||
|
url = BASE_URL + u
|
||||||
|
filename = 'img/' + u.replace('/', '_') + '.png'
|
||||||
|
print(f'fetching {url} ...')
|
||||||
|
subprocess.run(f"wkhtmltoimage -q --cookie {COOKIE_KEY} {COOKIE_VALUE} {url} {filename}", shell=True, check=True)
|
Loading…
Reference in New Issue
Block a user