- Nov 25, 2017
- 11,571
- 7,556
Bookmarked to see what comes up.
Please share whatever you do with others on this thread.
Thanks
Please share whatever you do with others on this thread.
Thanks
When commands are run do you need the output, or is it run and forget?Hey mate,
I need a dashboard that holds multiple Command Prompt CMD's (almost like Terminator on Linux) except whenever i restart the PC, the command i put into command prompt are saved
So i can restart PC, open up programme and run the commands without having to manually copy and paste the commands into CMD 300x times
(Yeah i run like 300 CMD's on my PC for my Instagram bot which is written in python)
When my PC reboots, i have to manually reopen 300 command prompts and re-paste the commands in![]()
Sorry, I seemed to have missed this one earlier. You will have to google how to set up your email for python access before it will work.For example a script to regular check a website home page eg: www.blackhatworld.com/home and whenever a predefined string parameter is matched it sends an alert
import os
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
import socket
EMAIL = 'your-email-here'
PWD = 'your-password-here'
SERVER = 'smtp-mail.outlook.com' # defaults to outlook
MESSAGE = 'your notification text here'
SUBJECT = "Python Notification"
CHECK_INTERVAL = 60 #interval is in seconds.
def send(msg, server=SERVER, port='587'):
# contain following in try-except in case of momentary network errors
try:
# initialise connection to email server, the default is Outlook
smtp = smtplib.SMTP(server, port)
# this is the 'Extended Hello' command, essentially greeting our SMTP or ESMTP server
smtp.ehlo()
# this is the 'Start Transport Layer Security' command, tells the server we will
# be communicating with TLS encryption
smtp.starttls()
# login to outlook server
smtp.login(EMAIL, pwd)
# send notification to self
smtp.sendmail(EMAIL, EMAIL, msg.as_string())
# disconnect from the server
smtp.quit()
except socket.gaierror:
print("Network connection error, email not sent.")
def message(subject=SUBJECT, text=MESSAGE, img=None, attachment=None):
# build message contents
msg = MIMEMultipart()
msg['Subject'] = subject # add in the subject
msg.attach(MIMEText(text)) # add text contents
# check if we have anything given in the img parameter
if img is not None:
# if we do, we want to iterate through the images, so let's check that
# what we have is actually a list
if type(img) is not list:
img = [img] # if it isn't a list, make it one
# now iterate through our list
for one_img in img:
img_data = open(one_img, 'rb').read() # read the image binary data
# attach the image data to MIMEMultipart using MIMEImage, we add
# the given filename use os.basename
msg.attach(MIMEImage(img_data, name=os.path.basename(one_img)))
# we do the same for attachments as we did for images
if attachment is not None:
if type(attachment) is not list:
attachment = [attachment] # if it isn't a list, make it one
for one_attachment in attachment:
with open(one_attachment, 'rb') as f:
# read in the attachment using MIMEApplication
file = MIMEApplication(
f.read(),
name=os.path.basename(one_attachment)
)
# here we edit the attached file metadata
file['Content-Disposition'] = f'attachment; filename="{os.path.basename(one_attachment)}"'
msg.attach(file) # finally, add the attachment to our message object
return msg
if __name__ == '__main__':
url = input('Paste in the url to monitor and press Enter... ')
kws = input('Paste in keyword(s) and press Enter. If multiple, seperate by comma. ')
kws = [kw.lower().strip() for kw in kws.split(',')]
while True:
try:
r = requests.get(url)
soup = BeautifulSoup(r.text)
strings = list(BeautifulSoup.stripped_strings)
for kw in kws:
for s in strings:
if kw in s.lower():
send(message(
subject=SUBJECT,
text=f"Found {kw} on {url}\n{MESSAGE}",
)
)
break
except Exception as e:
print('hit exception:', str(e))
finally:
time.sleep(CHECK_INTERVAL)
Seems pretty easy tbh. Are your sentences already in spintax? Writing a parser / spinner could be fun.Thanks for the reply
I need something advanced article generator
Like:
I will have a csv sheet with thousands of keywords
And an article of about 200 sentences (every sentence will have almost 10 variations)
The article generator will take random choice from first to 200th sentence and also include keyword in some given places
I will PM more details if you have some time to discuss
Thanks
Free tool httrack website copierI am interested I am looking for e-commerce website scrapper
Free tool httrack website copierInterested in web scrapping scripts. Thanks
https://colab.research.google.com/d...aBsOcrie2Q1?usp=sharing#scrollTo=rV-872nuq8lQI need gpt-3 article writer
https://colab.research.google.com/d...aBsOcrie2Q1?usp=sharing#scrollTo=rV-872nuq8lQi need gpt-3 article creator
Free tool httrack website copierInterested in web scrapping scripts
have you tried creating a .bat file? take all your commands and put them into text file on one line each. Then save it with the .bat extension. double clicking the file will then run all the commands inside.
When commands are run do you need the output, or is it run and forget?
Hey, thanks for that colab link! Super cool! I like where your head is at with this one, seems pretty quick and easy too. Are sites already scraped to disk?Hi, I`m interested in script that can translate scraped website html pages using deepL api.
You could go the python route and make something custom for managing your accounts. Or you could also just start new command prompt windows from your batch file.I did this and it only runs the first command, since it's an ongoing script, the 2nd one doesn't run since it's all in 1 CMD. I think we need multithreading and multiple CMD's to open.
My accounts are dynamic, and I am often editing account settings while running other accounts. Once settings change I terminate the script for that 1 account and rerun the script after editing a notepad configuration YML file.
Yes, we need the output to tell us when there is a problem with the phone
@echo off
start "My New Window" account1.bat
start "My New Window" account1.bat
start "My New Window" account1.bat
FULL\PATH\TO\python.exe FULL\PATH\TO\script.py
python -c "import sys; print(sys.executable)"
Hey, thanks for that colab link! Super cool! I like where your head is at with this one, seems pretty quick and easy too. Are sites already scraped to disk?
Hey, thanks for that colab link! Super cool! I like where your head is at with this one, seems pretty quick and easy too. Are sites already scraped to disk?
You could go the python route and make something custom for managing your accounts. Or you could also just start new command prompt windows from your batch file.
I tried to get this to all work from one call to the cmd command. using the start command but any arguments or commands didn't seem to pass through, so I resorted to making batch files for the each account. A little painful, sure, but better than having to do it manually every time. And you get a 1 click shortcut to relaunch an account + the ability to title your windows.
The example below will run the account.bat file in three separate windows. Make sure that run.bat is in the same directory as your account.bat files
run.bat:
@echo off start "My New Window" account1.bat start "My New Window" account1.bat start "My New Window" account1.bat
account1.bat:
FULL\PATH\TO\python.exe FULL\PATH\TO\script.py
Add any arguments you might need to each account.bat file. You can get your python path by pasting:
python -c "import sys; print(sys.executable)"
into your terminal.
I do a fair bit of Selenium scripting, would be happy to take a look for you. I noticed neither you or luck45 have enough posts for PM's. Would you be willing to post it publicly?
import undetected_chromedriver.v2 as uc
import time
options = uc.ChromeOptions()
options.headless = True
searchterm = input("Input player name: ")
searchcode = searchterm.replace(" ", "+")
driver = uc.Chrome(options=options)
searchlink = "https://www.whoscored.com/Search/?t=" + searchcode
driver.get(searchlink)
searcher = WebDriverWait(driver, 40).until(
EC.presence_of_element_located((By.CLASS_NAME, "search-result"))
)
link = searcher.find_element(By.XPATH, "//a[@class='iconize iconize-icon-left']")
link.click()
time.sleep(2)
player = WebDriverWait(driver, 40).until(
EC.presence_of_element_located((By.CLASS_NAME, "rating"))
)
name = player.find_element(By.XPATH, "//h1[@class='header-name']")
age = player.find_element(By.XPATH, "//a[@class='team-link'][1]//..//..//div[position() = (last() - 3)]")
age = age.text[5:7]
team = player.find_element(By.XPATH, "//a[@class='team-link'][1]")
rating = player.find_element(By.XPATH, "//tbody[@id='player-table-statistics-body']//td[@class='rating']")
apps = player.find_element(By.XPATH, "//tbody[@id='player-table-statistics-body']//tr[last()]//td[2]")
goals = player.find_element(By.XPATH, "//tbody[@id='player-table-statistics-body']//tr[last()]//td[4]")
intapps = player.find_elements(By.XPATH, "//a[@class='team-link info']//..//..//td[2]")
intappcount = 0
for intnl in intapps:
mintnl = intnl.text.split("(")
if len(mintnl) > 1:
numeric_filter = filter(str.isdigit, mintnl[1])
intsub = "".join(numeric_filter)
intnl = int(mintnl[0]) + int(intsub)
else:
intnl = int(mintnl[0])
intappcount += intnl
apps = int(apps.text) - intappcount
print(name.text + " is " + age + " and plays for " + team.text + ". He has played " + str(apps) + " times this season, scoring " + goals.text + " goals.")
hello, I am interested.Hi guys, hope you're doing well. I have some free time at the moment and thought I should give back to the community some. Just my way of saying thanks to such an awesome community.
I am willing to code any python script/bot you guys may want, just drop a comment down below with your request. However, please don't say something generic, like 'instagram bot'. Be specific in what it is you need done.
I'll be releasing all completed scripts in this thread, so be sure to sub!