├── .DS_Store ├── README.md ├── scraper.py └── sendMessage.scpt /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yR-DEV/py-scraper-texter/fcd1a9d9cca4b968618b5a5bf7d6ec3118df43c7/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Required Technologies 2 | - text editor 3 | - python 4 | - terminal 5 | - OSx (for iMessages) 6 | 7 | ### Setup 8 | ```pip install beautifulsoup``` 9 | ```pip install apscheduler``` 10 | 11 | - You can change the url to whatever you want, you just may have to add logic to sort more 12 | - Remember to replace `YOUR_NUMBER_HERE` and `YOUR_MESSAGE_HERE` in lines 19 and 22 of `scraper.py` 13 | - ALSO REMEMBER to change the interval value on line 26 of `scraper.py` for delay time between script runs 14 | 15 | ### Medium Blog Post 16 | https://medium.com/@yeah_right/so-i-wrote-a-py-web-scraper-that-sends-me-scpt-text-messages-about-job-postings-34ffef9a1128 17 | -------------------------------------------------------------------------------- /scraper.py: -------------------------------------------------------------------------------- 1 | import os 2 | import requests 3 | 4 | from BeautifulSoup import BeautifulSoup 5 | from apscheduler.schedulers.blocking import BlockingScheduler 6 | from datetime import datetime 7 | sch = BlockingScheduler() 8 | 9 | def main(): 10 | url = 'https://www.indeed.com/jobs?q=web%20developer&l=Denver%2C%20CO&vjk=0c0f7c56b3d79b4c' 11 | response = requests.get(url) 12 | html = response.content 13 | 14 | soup = BeautifulSoup(html) 15 | matches = soup.findAll(name='div', attrs={'class': 'title'}) 16 | 17 | for jobTitle in matches: 18 | if "Junior" in jobTitle.text: 19 | os.system("osascript sendMessage.scpt YOUR_NUMBER_HERE 'Just one' ") 20 | break 21 | elif "Jr" in jobTitle.text: 22 | os.system("osascript sendMessage.scpt YOUR_NUMBER_HERE 'how many' ") 23 | break 24 | return; 25 | 26 | sch.add_job(main, 'interval', seconds=2) 27 | print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) 28 | 29 | try: 30 | sch.start() 31 | except (KeyboardInterrupt, SystemExit): 32 | pass 33 | -------------------------------------------------------------------------------- /sendMessage.scpt: -------------------------------------------------------------------------------- 1 | on run {targetPhoneNumber, targetMessageToSend} 2 | repeat 1 times 3 | tell application "Messages" 4 | set targetService to 1st service whose service type = iMessage 5 | set targetBuddy to buddy targetPhoneNumber of targetService 6 | set targetMessage to targetMessageToSend 7 | send targetMessage to targetBuddy 8 | end tell 9 | end repeat 10 | end run --------------------------------------------------------------------------------