save_torrent -> self.save_torrent
This commit is contained in:
parent
d368165bb0
commit
fbb554f198
10
oppaiBot.py
10
oppaiBot.py
|
@ -22,9 +22,8 @@ class OppaiBot(irc.IRCClient):
|
||||||
self.nickname = self.config["nickname"]
|
self.nickname = self.config["nickname"]
|
||||||
self.username = self.config["ident"]
|
self.username = self.config["ident"]
|
||||||
|
|
||||||
cookies_txt = self.config["cookies_txt"]
|
self.cj = http.cookiejar.MozillaCookieJar(self.config["cookies_txt"])
|
||||||
self.cookies = http.cookiejar.MozillaCookieJar(cookies_txt)
|
self.cj.load()
|
||||||
self.cookies.load()
|
|
||||||
|
|
||||||
self.watch_dir = self.config["watch_dir"]
|
self.watch_dir = self.config["watch_dir"]
|
||||||
|
|
||||||
|
@ -33,8 +32,7 @@ class OppaiBot(irc.IRCClient):
|
||||||
"""
|
"""
|
||||||
Downloads and saves the torrent file to the given directory.
|
Downloads and saves the torrent file to the given directory.
|
||||||
"""
|
"""
|
||||||
res = requests.get(url, cookies=self.cookies, headers=HEADERS,
|
res = requests.get(url, cookies=self.cj, headers=HEADERS, verify=True)
|
||||||
verify=True)
|
|
||||||
res.raise_for_status()
|
res.raise_for_status()
|
||||||
fname = re.search("filename=(.+)", res.headers['content-disposition'])
|
fname = re.search("filename=(.+)", res.headers['content-disposition'])
|
||||||
fname = fname.group(1)
|
fname = fname.group(1)
|
||||||
|
@ -52,7 +50,7 @@ class OppaiBot(irc.IRCClient):
|
||||||
# More advanced logic is left as an exercise to the reader.
|
# More advanced logic is left as an exercise to the reader.
|
||||||
if "English" in message or "Dual Language" in message:
|
if "English" in message or "Dual Language" in message:
|
||||||
url = message.split(" - ")[1].split(" / ")[1]
|
url = message.split(" - ")[1].split(" / ")[1]
|
||||||
save_torrent(url, self.watch_dir)
|
self.save_torrent(url, self.watch_dir)
|
||||||
|
|
||||||
|
|
||||||
def joined(self, channel):
|
def joined(self, channel):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user