forked from swee/MeowNex
Update sweebot.py
This commit is contained in:
parent
13bf8db116
commit
166fb01bc5
1 changed files with 3 additions and 4 deletions
|
@ -13,8 +13,7 @@ from pathlib import Path
|
||||||
from requests import get
|
from requests import get
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
headers = {
|
headers = {
|
||||||
'User-Agent': 'SweeBot IRC ' + __version__,
|
'User-Agent': 'SweeBot IRC ' + __version__
|
||||||
'From': 'bot@swee.codes'
|
|
||||||
}
|
}
|
||||||
class config:
|
class config:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -577,14 +576,14 @@ while True:
|
||||||
try:
|
try:
|
||||||
for i in command:
|
for i in command:
|
||||||
if i[:8] == "https://":
|
if i[:8] == "https://":
|
||||||
e = get(i, headers=headers)
|
e = get(i, headers=headers, timeout=10)
|
||||||
if e.ok:
|
if e.ok:
|
||||||
soup = BeautifulSoup(e.text, 'html.parser')
|
soup = BeautifulSoup(e.text, 'html.parser')
|
||||||
multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel)
|
multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel)
|
||||||
else:
|
else:
|
||||||
multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel)
|
multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel)
|
||||||
elif i[:7] == "http://":
|
elif i[:7] == "http://":
|
||||||
e = get(i, headers=headers)
|
e = get(i, headers=headers, timeout=10)
|
||||||
if e.ok:
|
if e.ok:
|
||||||
soup = BeautifulSoup(e.text, 'html.parser')
|
soup = BeautifulSoup(e.text, 'html.parser')
|
||||||
multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel)
|
multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel)
|
||||||
|
|
Loading…
Reference in a new issue