Compare commits

..

No commits in common. "5b4ae05582b700260190f9a6114638b7d3c5e7a5" and "dd371e3326020898f2c14a26037ff697e9763617" have entirely different histories.

3 changed files with 3 additions and 15 deletions

View File

@ -1,11 +1,10 @@
import ollama import ollama
import scraper_functions as sf
def processmsg(msg, rcpt): def processmsg(msg, rcpt):
if "youtube.com/watch" in msg: if msg.startswith("!"):
return command(msg, rcpt)
elif "youtube.com/watch" in msg:
return msg.replace("youtube.com", "iv.datura.network") return msg.replace("youtube.com", "iv.datura.network")
elif msg.startswith("!wiki"):
return sf.query_external_website("https://en.wikipedia.org/wiki/", msg.split(" ")[1])
elif "good bot" in msg: elif "good bot" in msg:
return "^_^" return "^_^"

View File

@ -1,4 +1,2 @@
slixmpp slixmpp
ollama ollama
requests
beautifulsoup4

View File

@ -1,9 +0,0 @@
import requests
from bs4 import BeautifulSoup
def query_external_website(base_url, query):
page = requests.get(base_url + query)
soup = BeautifulSoup(page.content, "html.parser")
title = soup.find("span", class_="mw-page-title-main").text
content = soup.find(id="mw-content-text").select("p")[2].text
return "\nTITLE:\n" + title + "\n\nCONTENT:\n" + content + "\n\nFULL LINK:\n" + base_url + query