b3b6b702d1
- publish_gatekeeper.py (neues Gatekeeper-System) - 4 Premium-Artikel: Veggie Match, Berlin 1960, Wild Tiled West, Scream Park - Alle kumulierten Artikel, Scripts, Medien und Caches
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
#!/home/hermes/venv/bin/python3
|
|
"""Get Lacrimosa cover + Amazon price"""
|
|
from amazon_creatorsapi import AmazonCreatorsApi
|
|
import urllib.request, json
|
|
|
|
api = AmazonCreatorsApi(
|
|
credential_id='amzn1.application-oa2-client.91799968d0744e66950ea413659197d4',
|
|
credential_secret='amzn1.oa2-cs.v1.4c41154ecfd1835e00879ad5c8060ef5cd3b209b06077c0af1d868b343cab955',
|
|
version='3.2', tag='60pro05-21', marketplace='www.amazon.de', throttling=1.0
|
|
)
|
|
|
|
result = api.search_items(keywords='B0C7RKGFYX', item_count=1,
|
|
resources=['images.primary.large', 'itemInfo.title', 'offersV2.listings.price'])
|
|
d = result.model_dump()
|
|
item = d['items'][0]
|
|
|
|
# Image
|
|
img_url = item['images']['primary']['large']['url']
|
|
img_url_hi = img_url.replace('_SL500_', '_AC_SL1500_')
|
|
print(f"TITLE: {item['item_info'].get('title', {}).get('display_value', '?')}")
|
|
print(f"IMG_HI: {img_url_hi}")
|
|
|
|
urllib.request.urlretrieve(img_url_hi, '/tmp/cover_Lacrimosa.jpg')
|
|
print("DOWNLOADED cover_Lacrimosa.jpg")
|
|
|
|
# Price
|
|
listings = item.get('offers_v2', {}).get('listings', [])
|
|
if listings:
|
|
p = listings[0]['price']
|
|
money = p.get('money', {})
|
|
print(f"AMAZON_PRICE: {money.get('formatted_price', '?')}")
|
|
sv = p.get('savings')
|
|
if sv:
|
|
print(f"AMAZON_SAVINGS: {sv.get('percentage')}% - {sv.get('formatted_price', '?')}")
|
|
|
|
# Also output JSON for img
|
|
img_id = img_url.split('/I/')[1].split('._')[0] if '/I/' in img_url else '?'
|
|
print(f"IMG_ID: {img_id}")
|