-
Notifications
You must be signed in to change notification settings - Fork 0
/
zwift.py
70 lines (52 loc) · 2.12 KB
/
zwift.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import requests
import time
import json
import random
def zwift_scraper():
# Define the URL
# Get the current timestamp in milliseconds
current_timestamp = int(time.time() * 1000)
# Generate a random number between 1 and 1000
random_number = random.randint(1, 1000)
# Combine the timestamp and random number to create a unique identifier
unique_identifier = f"{current_timestamp}-{random_number}"
# Define the URL with the unique identifier appended
url = f"https://boards-api.greenhouse.io/v1/boards/zwift/departments?timestamp={unique_identifier}"
# Make your request using the URL
response = requests.get(url)
# Check the response status code
print("Response Status Code:", response.status_code)
data = response.text
states = ["AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "IA",
"ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO",
"MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK",
"OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI",
"WV", "WY", "DC", "USA", "United States"]
states = [' ' + state for state in states]
# Add a space before each initial
list1 = []
data = json.loads(data)
for job in data["departments"]:
if job["jobs"]:
for i in job["jobs"]:
item = {}
item['role'] = i['title']
item['link'] = i['absolute_url']
item['company'] = "Zwift"
item['location'] = i['location']['name']
list1.append(item)
new_list = []
for job in list1:
if "intern" in job["role"].lower():
new_list.append(job)
new_list2 = []
for job in new_list:
bool1 = False
for i in states:
if i in job["location"]:
bool1 = True
if bool1:
new_list2.append(job)
return new_list2
if __name__ == "__main__":
print(zwift_scraper())