Skip to content
This repository was archived by the owner on Mar 25, 2023. It is now read-only.

Commit 8681edc

Browse files
committed
just put some headers in
maybe that'll stop some of the problems cause mainting this aint fun
1 parent 3d2d3c2 commit 8681edc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/NSFW.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ async def getPostList(msg,sitetype,tags):
3131
index = 0
3232
if sitetype == "rule34" or sitetype == "realbooru": #Identical format for whatever reason
3333
site = (sitetype == "rule34" and "rule34.xxx") or "realbooru.com"
34-
postList = requests.get(f"https://{site}/index.php?page=dapi&s=post&q=index&limit=100&tags="+tags).text
34+
postList = requests.get(f"https://{site}/index.php?page=dapi&s=post&q=index&limit=100&tags="+tags, headers={"User-Agent":"TalkBot/1.3"}).text
35+
print(postList)
3536
postList = regex.sub("\nfemale","female",postList) #Tag bug
3637
postList = regex.sub("\nboots","boots",postList) #Tag bug
3738
postList = regex.sub("\n[ a-z]","▓",postList) #General tag bug catch
@@ -78,7 +79,7 @@ async def getPostList(msg,sitetype,tags):
7879
else:
7980
anyMessageFiltered = True
8081
elif sitetype == "danbooru": #Simplest one yet (mostly)
81-
postList = requests.get("https://danbooru.donmai.us/posts.json?limit=100&tags="+tags).text
82+
postList = requests.get("https://danbooru.donmai.us/posts.json?limit=100&tags="+tags, headers={"User-Agent":"TalkBot/1.3"}).text
8283
loaded = json.loads(postList)
8384
for i in loaded:
8485
if not exists(i,"id") or i["is_banned"] == True or not ("file_url" in i):

0 commit comments

Comments
 (0)