Compare commits
No commits in common. "7f9cac6be85f4483c2efd7b28ade6b30cdd579ad" and "83cb2f5c74373944d2ec0a8f0b5581bf3512bb98" have entirely different histories.
7f9cac6be8
...
83cb2f5c74
21
LICENSE
21
LICENSE
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Isaac Shoebottom
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
28
README.md
28
README.md
@ -1,28 +0,0 @@
|
||||
# Kings Landing Job Scraper
|
||||
|
||||
A simple python script that scrapes from their site, checks if there is a new job, and then if there is, it tells you and sends a console bell command to your terminal.
|
||||
|
||||
The default interval for checking is 3 hours, but can be changed with an argument.
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone the repo
|
||||
2. Install the requirements with `pip install -r requirements.txt`
|
||||
|
||||
You might want to create a virtual environment for this, if you don't know how to do that, [here's a guide](https://docs.python.org/3/library/venv.html).
|
||||
Then, you can activate it with `source venv/bin/activate` on Linux and `venv\Scripts\activate` on Windows.
|
||||
|
||||
|
||||
Virtual environments are a good way to keep your system clean and avoid conflicts with other projects. If you do not have any other projects or are fine with installing the requirements globally, you can skip this step.
|
||||
|
||||
## Usage
|
||||
1. Run the script with `python scraper.py`
|
||||
2. If you want to change the interval, run the script with `python scraper.py <interval in hours>`
|
||||
|
||||
If you want to turn off the bell sound, you can do so by commenting out the `print("\a")` line.
|
||||
|
||||
## Exiting the program
|
||||
To exit the program, press `Ctrl+C` or close the terminal window.
|
||||
|
||||
## License
|
||||
See [LICENSE](LICENSE)
|
15
scraper.py
15
scraper.py
@ -28,13 +28,10 @@ def scrape():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
testing = True
|
||||
will_exit = False
|
||||
|
||||
hours = 3
|
||||
|
||||
arg_count = len(sys.argv)
|
||||
if arg_count == 1: # No arguments
|
||||
if arg_count == 1: # No arguments
|
||||
print("No arguments given, using default value of 3 hours")
|
||||
else:
|
||||
try:
|
||||
@ -53,15 +50,14 @@ if __name__ == '__main__':
|
||||
while True:
|
||||
try:
|
||||
tmp = scrape()
|
||||
if text != tmp or testing:
|
||||
print("\a")
|
||||
if text != tmp:
|
||||
print("New job posting! Here's the text:")
|
||||
print(tmp)
|
||||
print("And here's the link: https://kingslanding.nb.ca/employment/")
|
||||
print("Do you want to keep checking? (y/n): ", end="")
|
||||
choice = input()
|
||||
if choice == "n" or choice == "N":
|
||||
will_exit = True
|
||||
break
|
||||
else:
|
||||
text = tmp
|
||||
except urllib.error.URLError as err:
|
||||
@ -71,7 +67,4 @@ if __name__ == '__main__':
|
||||
print("An unknown error has occurred: {}".format(err))
|
||||
|
||||
finally:
|
||||
if will_exit:
|
||||
exit(0)
|
||||
else:
|
||||
time.sleep(timer)
|
||||
time.sleep(timer)
|
||||
|
Loading…
Reference in New Issue
Block a user