-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspygot.py
63 lines (48 loc) · 1.43 KB
/
spygot.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
import requests
class jerk(object):
def __init__(self, episode):
#day episode was posted
self.day = episode["day"]
#episode version
self.version = episode["version"]
#characters appearing in episode
self.players = episode["players"]
#year episode was posted
self.year = episode["year"]
#url to episode
self.url = "jerkcity.com/_" + episode["url"]
#thumbnail url
self.thumbnail = "jerkcity.com/" + episode["thumbnail"]
#image url
self.image = "jerkcity.com/" + episode["image"]
#list of tags (if available)
self.tags = episode["tags"]
#episode title
self.title = episode["title"]
#episode number
self.episodeNum = episode["episode"]
#month episode was posted
self.month = episode["month"]
#list of dialog quotes in order, if available
if "dialog" in episode:
self.dialog = episode["dialog"]
#parses dialog into an easily read list of strings, or tells you if no dialog has been included
def parseDialog(self):
try:
strs = []
for quotes in self.dialog:
string = quotes[0] + ": " + quotes[1]
strs.append(string)
return strs
except:
print "dialog doesn't exist!"
#returns a jerk object
#blame boots for the variable names
def grab(dong):
dongRq = requests.get("http://jerkcity.com/json/" + str(dong) + ".json")
if dongRq.status_code == 404:
return "Post doesn't exist!"
else:
circumcised = dongRq.json()
nut = jerk(circumcised)
return nut