This commit is contained in:
Marc Beninca 2021-10-10 21:37:22 +02:00 committed by Marc Beninca
parent f9584f4458
commit a5c8873436
3 changed files with 4 additions and 6 deletions

View file

@ -1,7 +1,7 @@
import html.parser import html.parser
import requests import requests
import msys CHARSET = 'u8'
class Parser(html.parser.HTMLParser): class Parser(html.parser.HTMLParser):
@ -21,7 +21,7 @@ class HyperText:
self.load() self.load()
def load(self): def load(self):
hypertext = requests.get(self.location).content.decode(msys.CHARSET) hypertext = requests.get(self.location).content.decode(CHARSET)
parser = Parser() parser = Parser()
parser.feed(hypertext) parser.feed(hypertext)
self.links = parser.links self.links = parser.links

View file

@ -1 +0,0 @@
CHARSET = 'u8'

View file

@ -1,7 +1,6 @@
import os import os
import msys CHARSET = 'u8'
KEY = '%' KEY = '%'
SEPARATOR = f'{os.linesep}{os.linesep}' SEPARATOR = f'{os.linesep}{os.linesep}'
@ -9,7 +8,7 @@ SEPARATOR = f'{os.linesep}{os.linesep}'
class Package: class Package:
def __init__(self, package, files): def __init__(self, package, files):
for binary in [package, files]: for binary in [package, files]:
text = binary.decode(msys.CHARSET).strip() text = binary.decode(CHARSET).strip()
for item in text.split(SEPARATOR): for item in text.split(SEPARATOR):
line, *lines = item.split(os.linesep) line, *lines = item.split(os.linesep)
key = line.split(KEY)[1].lower() key = line.split(KEY)[1].lower()