Last active
January 8, 2021 08:23
-
-
Save JustHumanz/5d1a87fcdbea4f30684a5b202efb76e2 to your computer and use it in GitHub Desktop.
Nhentai checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests,xmltodict,re,schedule,time | |
from discord_webhook import DiscordWebhook, DiscordEmbed | |
URL = "https://rsshub.app/nhentai/search/parody%3Afate-grand-order" | |
def Find(string): | |
regex = r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))" | |
url = re.findall(regex,string) | |
return [x[0] for x in url] | |
def SendNude(title,image,link): | |
webhook = DiscordWebhook(url='your webhook url') | |
embed = DiscordEmbed(title=title) | |
embed.set_image(url=image) | |
embed.set_timestamp() | |
embed.set_url(link) | |
webhook.add_embed(embed) | |
webhook.execute() | |
class Nhentai(): | |
def __init__(self): | |
print("Start running...") | |
res = requests.get(URL) | |
self.title = [] | |
for item in xmltodict.parse(res.text)['rss']['channel']['item']: | |
self.title.append(item['title']) | |
def Check(self): | |
print("Start check...") | |
res = requests.get(URL) | |
for item in xmltodict.parse(res.text)['rss']['channel']['item']: | |
if item['title'] not in self.title: | |
print("Crottttt,New doujin "+item['title']) | |
SendNude(item['title'],Find(item['description'])[0],item['link']) | |
self.title.append(item['title']) | |
doujin = Nhentai() | |
schedule.every(30).minutes.do(doujin.Check) | |
while True: | |
schedule.run_pending() | |
time.sleep(1) | |
""" | |
res = requests.get(URL) | |
for item in xmltodict.parse(res.text)['rss']['channel']['item']: | |
print(Find(item['description'])[0]) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment