HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/.ipython/profile_default/history.sqlite
SQLite format 3@  #.v�
��(�
���
��F))�Gtableoutput_historyoutput_historyCREATE TABLE output_history
                            (session integer, line integer, output text,
                            PRIMARY KEY (session, line));O)indexsqlite_autoindex_output_history_1output_history�2�;tablehistoryhistoryCREATE TABLE history
                    (session integer, line integer, source text, source_raw text,
                    PRIMARY KEY (session, line))-Aindexsqlite_autoindex_history_1historyP++Ytablesqlite_sequencesqlite_sequenceCREATE TABLE sqlite_sequence(name,seq)�U�}tablesessionssessionsCREATE TABLE sessions (session integer
                            primary key autoincrement, start timestamp,
                            end timestamp, num_cmds integer, remark text)
�� A
2025-05-23 15:25:42.955460
��	sessions
�#�������������C	a3get_ipython().system('pip install twilio')!pip install twilio�Q		�W�Wimport requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta

# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)!

	


������������������					

			

													

   print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 14:24")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta

# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 14:24")  print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 15:27")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 15:27")
_�_C	a3get_ipython().system('pip install twilio')!pip install twilio�Q		�W�Wimport requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta

# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                 
���T	�Y�Yimport requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                  	 print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 15:27")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 15:27")
���V	�[�[import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 15:28")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 15:28")
���V	�[�[import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        # send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 20:28")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 20:28")
���T	�Y�Yimport requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                   int(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(minutes=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 20:28")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(minutes=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 20:28")
���X	�]�]import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #pr #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 17:28")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 17:28")
���T	�Y�Yimport requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+15074073576"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 星期天有票了!{area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 17:28")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 17:28")
���*		�/�/	import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                     
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 17:28")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "ACa2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-23 17:28")
���(
	�-�-
import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "ACa2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-25 16:00")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "ACa2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(10)
run_until("2025-05-25 16:00")
���(	�-�-import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "ACa2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                       
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(5)
run_until("2025-05-2 17:28")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(5)
run_until("2025-05-2 17:28")
���&	�+�+import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                  
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(5)
run_until("2025-05-25 16:00")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(5)
run_until("2025-05-25 16:00")
���(
	�-�-
import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(3)
run_until("2025-05-25 16:00")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(3)
run_until("2025-05-25 16:00")
U��U�9	�=�?# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC8a2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"

send_sms('test')
# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC8a2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"

send_sms('test')�9	�=�?# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC8a2a780795d52434523071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"

send_sms('test')
# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC8a2a780795d52434523071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"

send_sms('test')�(	�-�-import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC1171c857c61a9f2b20deb4c6e875642f"
TWILIO_AUTH_TOKEN = "561ccf35d5801b13e118de6be8f2418a"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+19788003538"
YOUR_PHONE_NUMBER = "+886906867137"


def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                   #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(1)
run_until("2025-05-25 16:20")import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC8a2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"



def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                    #print(f"❌ 星期天尚無票:{text}")
                    continue

    if not found:
        print("📭 網站未開放")

def run_until(deadline_str):
    deadline = datetime.strptime(deadline_str, "%Y-%m-%d %H:%M")

    last_hour_check = datetime.now()  # 用來追蹤上一個「整點提醒」
    notified_opened = False  # 可選:是否發送過「網站打開了!」

    while True:
        now = datetime.now()

        if now >= deadline:
            print("⏹️ 到達指定時間,停止執行")
            break

        #print(f"\n🔁 {now.strftime('%Y-%m-%d %H:%M:%S')} - 開始檢查")
        check_tickets()  # 你原本的函式

        # 若超過一小時,印出提示
        if now - last_hour_check >= timedelta(hours=1):
            t1=datetime.now()
            print(f"\n ⏰ {t1.strftime('%Y-%m-%d %H:%M:%S')} 一小時內無票")
            last_hour_check = now  # 更新時間

        time.sleep(1)
run_until("2025-05-25 16:20")
���V	�[�[import requests
from bs4 import BeautifulSoup
import time
import smtplib
from email.mime.text import MIMEText
from twilio.rest import Client
#from plyer import notification  # 桌面通知
import re
from datetime import datetime
from datetime import datetime, timedelta


# Twilio 帳戶資訊
# Twilio 帳戶資訊
TWILIO_ACCOUNT_SID = "AC8a2a780795d52435623071de0c5b6626"
TWILIO_AUTH_TOKEN = "b4a95a298841e743b921f4f7ce6d01c5"
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
TWILIO_PHONE_NUMBER = "+12403267359"
YOUR_PHONE_NUMBER = "+886906867137"



def send_sms(message):    
    client.messages.create(
        body=message,
        from_=TWILIO_PHONE_NUMBER,
        to=YOUR_PHONE_NUMBER
    )

# 🔹 拓元售票網址(請換成您的票務頁面) 星期天 19138  星期六 19137
URL = "https://tixcraft.com/ticket/area/25_jhope/19138"

# 🔹 目標座位名稱
#TARGET_SEAT = '橙1A-2區2800'  # 依照您的需求修改
TARGET_SEATS = ['橙1A-2區2800', "黃1A-1區2800",'3800','橙1A-1區2800','黃1A-2區2800']

##################################################################這個

def check_tickets():
    headers = {"User-Agent": "Mozilla/5.0"}
    response = requests.get(URL, headers=headers)


    soup = BeautifulSoup(response.text, "html.parser")

    seats = soup.find_all(["li", "a"])
    # ✅ 網站打開通知(只寄一次)
    found = False

    for seat in seats:
        text = "".join(seat.stripped_strings)

        for target_seat in TARGET_SEATS:
            if target_seat in text:
                found = True
                if "剩餘" in text or "remaining" in text:
                    area = text[:10]
                    match = text[10:]
                    match = re.search(r"(\d+)\s*seat\(s\) remaining", match)
                    if match:
                        remaining_seats = match.group(1)
                        result = f'🎉 {area} 剩餘 {remaining_seats} 張'
                        print(result)
                        send_sms(result)
                        #notify_desktop(result)
                else:
                    
                   "