Updating the dog function to pull form reddit boards too

This commit is contained in:
Luke 2019-10-08 11:39:16 -07:00
parent 40fff529c7
commit d3066f4d0d
2 changed files with 19 additions and 3 deletions

View File

@ -1,9 +1,11 @@
import random import random
import requests import requests
import get_from_reddit
def get_dog(): def get_dog():
return random.choice([random_sheeb, random_dog])() return random.choice([random_sheeb, random_dog, random_dog_reddit])()
def random_sheeb(): def random_sheeb():
@ -21,6 +23,21 @@ def random_dog():
return "https://random.dog/{}".format(dog_url) return "https://random.dog/{}".format(dog_url)
def random_dog_reddit():
return get_from_reddit.get_image(
[
'AustralianCattleDog',
'GSP',
'corgi',
'dogpictures',
'rarepuppers',
'tippytaps',
'vizsla',
'zoomies',
]
)
def get_birb(): def get_birb():
return "https://random.birb.pw/img/{}".format( return "https://random.birb.pw/img/{}".format(
requests.get( requests.get(

View File

@ -22,9 +22,8 @@ def get_image(boards, nsfw=False):
'i3.kym-cdn.com', 'i3.kym-cdn.com',
'imgur.com', 'imgur.com',
'media.giphy.com', 'media.giphy.com',
'my.mixtape.moe',
] ]
print("chose %s" % boards)
request_string = "https://reddit.com/r/{}/random.json".format(boards) request_string = "https://reddit.com/r/{}/random.json".format(boards)
if not nsfw: if not nsfw: