Fixed issue with URL parsing

This commit is contained in:
sloumdrone 2018-10-29 20:04:29 -07:00
parent 9f0f37b8f7
commit f8d00aa48f
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ class parser:
def parse_url(self, url):
# Take in a URL and output a dict of the url parts
regex = r'^(?P<protocol>(?:gopher:\/\/)?)?(?P<host>[\w\.\d]+)(?P<port>(?::\d+)?)?(?P<type>(?:\/[\dgIp])?)?(?P<resource>(?:\/[\w\/\d\-?.]*)?)?$'
regex = r'^(?P<protocol>(?:(gopher|http):\/\/)?)?(?P<host>[\w\.\d]+)(?P<port>(?::\d+)?)?(?P<type>(?:\/[\dgIp])?)?(?P<resource>(?:\/\S*)?)?$'
match = re.match(regex, url)
protocol = match.group('protocol')