mirror of
https://github.com/leoncvlt/loconotion.git
synced 2024-08-30 18:12:12 +00:00
Merge pull request #75 from meSunnySrivastava/new-url-format
Use custom new Notion url format instead of hardcoded default one
This commit is contained in:
commit
b9fd73f777
@ -574,14 +574,18 @@ class Parser:
|
|||||||
)
|
)
|
||||||
soup.body.insert(-1, custom_script)
|
soup.body.insert(-1, custom_script)
|
||||||
|
|
||||||
|
hrefDomain = url.split('notion.site')[0] + 'notion.site'
|
||||||
|
log.info(f"Got the domain as {hrefDomain}")
|
||||||
|
|
||||||
# find sub-pages and clean slugs / links
|
# find sub-pages and clean slugs / links
|
||||||
sub_pages = []
|
sub_pages = []
|
||||||
parse_links = not self.get_page_config(url).get("no-links", False)
|
parse_links = not self.get_page_config(url).get("no-links", False)
|
||||||
for a in soup.find_all('a', href=True):
|
for a in soup.find_all('a', href=True):
|
||||||
sub_page_href = a["href"]
|
sub_page_href = a["href"]
|
||||||
if sub_page_href.startswith("/"):
|
if sub_page_href.startswith("/"):
|
||||||
sub_page_href = "https://www.notion.so" + a["href"]
|
sub_page_href = hrefDomain + '/'+ a["href"].split('/')[len(a["href"].split('/'))-1]
|
||||||
if sub_page_href.startswith("https://www.notion.so/"):
|
log.info(f"Got this as href {sub_page_href}")
|
||||||
|
if sub_page_href.startswith(hrefDomain):
|
||||||
if parse_links or not len(a.find_parents("div", class_="notion-scroller")):
|
if parse_links or not len(a.find_parents("div", class_="notion-scroller")):
|
||||||
# if the link is an anchor link,
|
# if the link is an anchor link,
|
||||||
# check if the page hasn't already been parsed
|
# check if the page hasn't already been parsed
|
||||||
|
Loading…
Reference in New Issue
Block a user