Fix other instances of off-by-one error.

This commit is contained in:
lost 2021-07-24 00:00:00 +00:00
parent 20d99f08fb
commit 79f945800e
2 changed files with 11 additions and 3 deletions

View File

@ -128,6 +128,10 @@ def extract (url, page=None, network=False, verbosity=3, args={}):
feed = extract_from_page (page, verbosity, url, args) feed = extract_from_page (page, verbosity, url, args)
if not feed is None: if not feed is None:
if feed.startswith("/"): if feed.startswith("/"):
domain = url[:url.find("/",url.find("//")+2)] index = url.find("/",url.find("//")+2)
if index == -1:
domain = url
else:
domain = url[:index]
feed = domain + feed feed = domain + feed
return feed return feed

View File

@ -12,8 +12,12 @@ if platform.endswith(".py"):
def extract_from_url (url, verbosity): def extract_from_url (url, verbosity):
# split into domain and path # split into domain and path
index = url.find("/",url.find("//")+2) index = url.find("/",url.find("//")+2)
domain = url[:index] if index == -1:
path = url[index:] domain = url
path = "/"
else:
domain = url[:index]
path = url[index:]
primary_domain = { primary_domain = {
"https://tumblr.com", "https://tumblr.com",