Posts random Morrowind quotes to Mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

30 lines
754 B

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())