Merge branch '1.9' into 'testing'

1.9

See merge request piotrex43/RcGcDw!62
This commit is contained in:
Frisk 2020-03-15 23:15:23 +00:00
commit 1fa2f92596
3 changed files with 339 additions and 272 deletions

28
misc.py
View file

@ -147,34 +147,6 @@ class ContentParser(HTMLParser):
self.current_tag = ""
class LinkParser(HTMLParser):
new_string = ""
recent_href = ""
def handle_starttag(self, tag, attrs):
for attr in attrs:
if attr[0] == 'href':
self.recent_href = attr[1]
if self.recent_href.startswith("//"):
self.recent_href = "https:{rest}".format(rest=self.recent_href)
elif not self.recent_href.startswith("http"):
self.recent_href = "https://{wiki}.gamepedia.com".format(wiki=settings["wiki"]) + self.recent_href
self.recent_href = self.recent_href.replace(")", "\\)")
def handle_data(self, data):
if self.recent_href:
self.new_string = self.new_string + "[{}](<{}>)".format(data, self.recent_href)
self.recent_href = ""
else:
self.new_string = self.new_string + data
def handle_comment(self, data):
self.new_string = self.new_string + data
def handle_endtag(self, tag):
misc_logger.debug(self.new_string)
def safe_read(request, *keys):
if request is None:
return None

579
rcgcdw.py

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"cooldown": 30,
"wiki": "minecraft",
"cooldown": 60,
"wiki_url": "https://ucp-rail-test.fandom.com/pl/",
"lang": "en",
"header": {
"user-agent": "RcGcDw/{version}"