Using AI to find my new camera π±
Iβve been shooting with my trusty Fujifilm XT-20 for more than 7 years now.
I was using several Nikons the prior 10 years, but the mirrorless size and weight, as well as the film simulations pulled me towards Fujifilm.
And up to this day, I'm still a Fujifilm fan.
Of all Fujifilm cameras, there has always been one Iβve been dreaming about. The X100. Ever since the X100f got launched, it had a certain spell on me. Its form factor, the way it looks, the optical viewfinder, β¦
Itβs like certain people that are pulled towards Leica.
With my XT-20 aging and my needs shifting more towards portability, usability (new film simulations) and connectivity (quickness of offloading and publishing photos), I decided it was finally time to upgrade and get the new X100VI. The latest iteration of the X100 series.
However, itβs a very popular camera (that's even an understatement) and very difficult to get one. Every store, whether it be physical or online, does not have it in stock. With an undefined delivery date.
All I can do now is to check each store, over and over again, until I can find one. But this is time-consuming. So I turned to ChatGPT to help me create a script to simplify this checking process.
Following my prompt, ChatGPT offered a python script that I could run via my browser through Google Colab, which I already use for other daily work checks.
After pasting the script in Google Colab, I can run it via every browser (desktop, mobile, β¦) and have a quick glance at the availability of the X100VI.
Hopefully, Iβll be able to find one soon π€.
In case youβre interested, this is the script Iβm using, where it checks for a specific text on each URL. Please don't hesitate to use and modify it for your purposes.
# @title Run script
import requests
from datetime import datetime
# List of URLs and the corresponding text to check for
products = [
{"url": "https://www.coolblue.be/nl/product/945321/fujifilm-x100vi-zilver.html", "text": "Tijdelijk uitverkocht"},
{"url": "https://www.coolblue.be/nl/product/945320/fujifilm-x100vi-zwart.html", "text": "Tijdelijk uitverkocht"},
{"url": "https://www.fiftypointeight.shop/nl/producten/fujifilm-x-x100vi-body-zilver/", "text": "Binnenkort verwacht"},
{"url": "https://www.fiftypointeight.shop/nl/producten/fujifilm-x-x100vi-body-zwart/", "text": "Binnenkort verwacht"},
{"url": "https://www.kamera-express.be/fujifilm-x100vi-zilver", "text": "Tijdelijk uitverkocht"},
{"url": "https://www.kamera-express.be/fujifilm-x100vi-zwart", "text": "Tijdelijk uitverkocht"},
{"url": "https://www.cameranu.nl/nl/p3428087/fujifilm-x100vi-compact-camera-zilver", "text": "Pre-order nu!"},
{"url": "https://www.cameranu.nl/nl/p3428084/fujifilm-x100vi-compact-camera-zwart", "text": "Pre-order nu!"},
{"url": "https://www.cameraland.nl/fujifilm-x100-vi-silver", "text": "Binnenkort beschikbaar"},
{"url": "https://www.cameraland.nl/fujifilm-x100-vi-black", "text": "Binnenkort beschikbaar"},
{"url": "https://www.grobet.be/nl/fujifilm-x100vi-silver-foto-grobet-fca072-001116", "text": "Tijdelijk uitverkocht, maar wel bestelbaar!"},
{"url": "https://www.grobet.be/nl/product/detail/fujifilm-x100vi-black/11357215", "text": "Tijdelijk uitverkocht, maar wel bestelbaar!"},
{"url": "https://www.fotocoudenys.be/fujifilm-x100vi-silver.html", "text": "Tijdelijk uitverkocht."},
{"url": "https://www.fotocoudenys.be/fujifilm-x100vi-black.html", "text": "Tijdelijk uitverkocht."}
]
# Headers to mimic a browser request
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
}
def check_availability(url, text):
try:
# Make the request with a timeout of 10 seconds
response = requests.get(url, headers=headers, timeout=10)
response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
# Check if the specific text is in the page content
if text in response.text:
return "π΄ Out of stock"
else:
return "π’ Available"
except requests.exceptions.HTTPError as e:
return f"Error: {e}" # Return the HTTP error (e.g., 403 Forbidden)
except requests.exceptions.RequestException as e:
return f"Request failed: {e}" # Handle other exceptions like timeouts
def main():
# Get current time
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"Last run: {current_time} (GMT) - Checking product availability...\n")
for product in products:
url = product["url"]
text = product["text"]
status = check_availability(url, text)
print(f"{status} - {url}")
if __name__ == "__main__":
main()
Perhaps there are beter solutions, but this is the one I came up with the least amount of time researching and implementing.
π¬ Reply via email, π Mastodon or π¦ Bluesky.