Пример #1
0
def main(args):
    CONFIG = getCommandLineConfig(args)
    if not CONFIG:
        CONFIG = getConfigFromFile()
    print("_________________________________")
    print("     Marktplaats Scraper ")
    print(" ")
    print(" by jaspercardol")
    print("_________________________________")
    print(" ")
    print("Configuration:")
    print("Scanning interval: {}".format(CONFIG['scanning_interval']))
    print("Pushover API Token: {}".format(CONFIG['pushover_api_token']))
    print("Pushover User Key: {}".format(CONFIG['pushover_user_key']))
    print(" ")
    notifier = NotificationService(CONFIG['pushover_api_token'],CONFIG['pushover_user_key'])
    fileWatcher = FileWatcher()
    print("Initial file scan found {} queries.".format(len(fileWatcher.getFiles())))
    scraper = Scraper(CONFIG['webdriverpath'])
    try:
        while True:
            files = fileWatcher.getFiles()
            for file in files:
                query = files[file]['query']
                filepath = files[file]['listing_filepath']
                check_for_updates(filepath,query,scraper, notifier)
            time.sleep(CONFIG['scanning_interval'])
    except KeyboardInterrupt:
        exit()
Пример #2
0
 def __init__(self, app):
     self.app = app
     self.notificationService = NotificationService()