staalptkram/templates/marktplaats.html
2020-01-29 22:05:28 +01:00

81 lines
1.7 KiB
HTML

{##}
<html>
<head>
<meta http-equiv="refresh" content="60">
<style>
main {
font-family: sans-serif;
max-width: 600px;
margin: 0 auto;
}
form {
display: flex;
align-items: center;
}
input[type=text] {
flex: 1;
}
h1 {
font-size: 1em;
}
.listing {
display: flex;
padding: 8px;
border-bottom: 1px solid rgba(0, 0, 0, .12);
box-sizing: border-box;
}
.listing:hover {
background-color: rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(0, 0, 0, 0);
}
.listing > div:first-child {
flex: 1;
}
a {
color: inherit;
text-decoration: none;
}
</style>
</head>
<body>
<main>
<form method="get">
URL:
<input type="text" name="apiurl" value="{{apiurl}}" placeholder="https://www.marktplaats.nl/lrp/api/search?...">
<input type="submit" value="h">
</form>
{% for listing in listings %}
<a href="https://marktplaats.nl{{listing.vipUrl}}">
<div class="listing">
<div>
<h1>{{listing.title}}</h1>
<p>
&euro;{{ "{:.2f}".format(listing.priceInfo.priceCents / 100) }}
{{listing.priceInfo.priceType}}
<br>
{{dateparse(listing.date).astimezone(tz).strftime("%Y-%m-%d %H:%M")}}
<br>
{{listing.location.cityName}} ({{listing.location.distanceMeters // 1000}} km)
</p>
</div>
{% for image in listing.imageUrls %}
<img src="{{ image }}" />
{% endfor %}
</div>
</a>
{% endfor %}
</main>
</body>
</html>