Last active
June 5, 2018 22:59
-
-
Save willwade/74526677292ca459e4d340bed66e49ca to your computer and use it in GitHub Desktop.
restart-pm2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# virtualenv venv | |
# source venv/bin/activate | |
# pip install selenium | |
# cd venv/bin | |
# curl -O https://chromedriver.storage.googleapis.com/2.39/chromedriver_linux64.zip | |
# unzip chromedriver_linux64.zip | |
import re, urlparse | |
from selenium import webdriver | |
from time import sleep | |
import subprocess | |
link = 'https://aacinfo.email/posts' | |
class AACInfoScraper(object): | |
def __init__(self): | |
options = webdriver.ChromeOptions() | |
options.add_argument('headless') | |
self.driver = webdriver.Chrome('venv/bin/chromedriver', chrome_options=options) | |
self.driver.set_window_size(1120, 550) | |
def scrape(self): | |
sels = self.scrape_job_links() | |
self.driver.quit() | |
def scrape_job_links(self): | |
self.driver.get(link) | |
source = self.driver.page_source | |
# Products & Services | |
if 'Updates' in source: | |
print('Yes') | |
else: | |
print('No') | |
print subprocess.check_output(['pm2','restart','aacinfo']) | |
return True | |
if __name__ == '__main__': | |
scraper = AACInfoScraper() | |
scraper.scrape() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment