#๐ DRAINING cpu usage in python anywhere for a simple concept??
13 messages ยท Page 1 of 1 (latest)
@dull gyro
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
import time
from datetime import datetime
import smtplib
from email.mime.text import MIMEText
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException, WebDriverException
# ==================== CONFIG ====================
CHECK_INTERVAL = 25 * 60 # 25 minutes
YOUR_EMAIL = "[email protected]"
APP_PASSWORD = "redacted"
TO_EMAIL = ["[email protected]", "[email protected]"]
URLS = [
"https://www.rottentomatoes.com/m/ella_mccay",
"https://www.rottentomatoes.com/m/zootopia_2",
"https://www.rottentomatoes.com/m/wicked_for_good",
"https://www.rottentomatoes.com/m/five_nights_at_freddys_2",
"https://www.rottentomatoes.com/m/avatar_fire_and_ash",
"https://www.rottentomatoes.com/m/the_running_man_2025"
]
# ==================== SETUP SELENIUM ====================
def create_driver():
chrome_options = Options()
chrome_options.add_argument("--headless=new")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--disable-software-rasterizer")
chrome_options.add_argument("--remote-debugging-port=0") # prevents core dumps
return webdriver.Chrome(options=chrome_options)
# ==================== EMAIL FUNCTION ====================
def send_email(subject, body):
msg = MIMEText(body)
msg["Subject"] = subject
msg["From"] = YOUR_EMAIL
msg["To"] = ", ".join(TO_EMAIL)
try:
with smtplib.SMTP_SSL("smtp.gmail.com", 465) as server:
server.login(YOUR_EMAIL, APP_PASSWORD)
server.send_message(msg)
print(f":e_mail: Email sent! Subject: {subject}")
except Exception as e:
print(f":warning: Failed to send email: {e}")
!rule tos
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
They just want to be automatically pinged when a website's content changes, surely that's neither ToS, inappropriate, malicious or illegal? Possibly rule 10, but I mean that's a bit of a stretch, the code is a copy paste, but the question isn't. (also pretty sure rule 10 is for people reposnding lol)
(a) use any robots, spiders, crawlers, devices, scripts or other data gathering or extraction software and/or tools, whether automated or manual, to access, acquire, copy, monitor, scrape, data mine, or aggregate any content or any portion of the Services for any purpose
https://www.rottentomatoes.com/policies/terms-of-use
@dull gyro I'm not sure you're going about this the way you should be. This is a link to a github repo which should point you in the right direction: https://github.com/jaebradley/rotten_tomatoes_client. This way you don't need to set up a selenium instance (selenium has a large overhead, meaning it does a bunch of things which your usecase doesn't need. At first glance, this repo should do it with far less overhead
aah I see. It's against RT's ToS, not discords or pythons. My fault
This is some corporate jargon; its "prohibited" though a good lawyer could argue about the difference between private & commercial use
tldr; no, you cant receive help regarding this.
https://www.rottentomatoes.com/policies/terms-of-use
10. PROPRIETARY RIGHTS
As between you and Fandango, Fandango owns all right, title, ... Any unauthorized use of such materials or content is strictly prohibited.
Permission is granted solely to use the Services solely for personal consumer use, and not for commercial exploitation.
Any other use of the Services, including ..., any form of data extraction or data mining, or other commercial exploitation of any kind, without prior written permission of Fandango is strictly prohibited.
You also agree that you will not collect data from, or use any automated method (including, but not limited to robots, scripts, spiders, data extractors or other automated means) to collect data from, access or search, the Services, unless Fandango has separately given its express written authorization to do so.
Without limiting the foregoing, you agree that you shall not โ
(a) use any robots, spiders, crawlers, devices, scripts ... to access, acquire, copy, monitor, scrape, data mine, or aggregate any content or any portion of the Services for any purpose,
(b) ...
to be clear toward @dull gyro:
Permission is granted solely to use the Services solely for personal consumer use, and not for commercial exploitation. Any other use of the Services, including reproduction, modification, distribution, or republication, any form of data extraction or data mining, or other commercial exploitation of any kind, without prior written permission of Fandango is strictly prohibited. You also agree that you will not collect data from, or use any automated method (including, but not limited to robots, scripts, spiders, data extractors or other automated means) to collect data from, access or search, the Services, unless Fandango has separately given its express written authorization to do so.
You could shoot them an email and ask if you could be given permission to do this. Make sure to include details about your project, such as if you're will be making money from it, if it's just personal use, how often you plan to ping them and for how much data, etc. I doubt they'll respond, but it's always worth a shot!
As pointed out by the other 2, you might not find help here. That being said, this is a thing that has been done before, and almost any service you interact with will have a similar set of rules, regardless of how much they actually enforce it. There are plenty of examples of people doing the exact same thing elsewhere online - do with that information what you will, but my official recomendation is still to contact them and ask nicely
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.