1
0
Fork 0
fediverse-bots/morrowsay-bot/loadquotes.py

31 lines
754 B
Python

import sys
import os.path as op
from urllib.parse import urlparse
from pprint import pprint
import requests
from bs4 import BeautifulSoup
# --------------------------------------------------
URL = "https://elderscrolls.fandom.com/wiki/Generic_Dialogue_(Morrowind)"
def main():
print('REQUEST ' + URL)
resp = requests.get(URL)
soup = BeautifulSoup(resp.text, 'lxml')
print('DOWNLOADING')
res = [icont.string for icont in soup('i') if icont.string is not None]
with open('quotes.dat', 'w', encoding='utf-8') as file:
for quote in res:
print(quote, file=file)
print('YAY SUCCESS!\n\n! ! ! Now don\'t forget to run replacevars.py ! ! !')
if __name__ == '__main__':
sys.exit(main())