Troll & Toad: Pokemon TCG

Pokemon TCG price tracker using Python

You can use this script if you want to check price down on certain websites. I’m going to monitor Pokemon TCG (Reshiram & Charizard GX – 217/214 – Hyper Rare card) price on the Troll & Toad page in this demo and automatically send me an email if any price falls down occurs more than $50. This script can be used to all multiple websites.

import requests
from bs4 import BeautifulSoup
import smtplib
import time

URL="https://www.trollandtoad.com/pokemon/sun-moon-unbroken-bonds-singles/reshiram-charizard-gx-217-214-hyper-rare/1475446"
headers={"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"}

def check_price():
	page = requests.get(URL, headers=headers)
	soup = BeautifulSoup(page.content, "html.parser")

	title = soup.find("div", {"itemprop": "name"}).get_text()
	price = soup.find("div", {"class": "font-weight-bold font-default text-center"}).get_text().replace("$", "")
	converted_price = float(price[0:5])

	if(converted_price < 249): send_mail() print(title.strip()) print(converted_price) """testing purpose""" if(converted_price > 249): 
		send_mail()

def send_mail():
	server = smtplib.SMTP("smtp.gmail.com", 587) 
	server.ehlo()
	server.starttls()
	server.ehlo()
	server.login("<your_email>", "<your_email_password")

	subject = "Price fell down!"
	body = "Check here: https://www.trollandtoad.com/pokemon/sun-moon-unbroken-bonds-singles/reshiram-charizard-gx-217-214-hyper-rare/1475446"
	msg = f"Subject: {subject}\n\n{body}"

	server.sendmail(
		"<email_from>",
		"<email_to>",
		msg
	)

	print("Email sent.")

	server.quit()

while(True):
	check_price()
	time.sleep(60)

Leave a Reply

Your email address will not be published. Required fields are marked *