Merge pull request #70 from bryanhpchiang/master

Fixed parsing for notion.site URLs
This commit is contained in:
Leonardo Cavaletti 2021-07-22 17:16:12 +01:00 committed by GitHub
commit 4bd84256e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
from notionparser import Parser
import os
import sys
import logging
@ -11,11 +12,10 @@ try:
import requests
import toml
except ModuleNotFoundError as error:
log.critical(f"ModuleNotFoundError: {error}. have your installed the requirements?")
log.critical(
f"ModuleNotFoundError: {error}. have your installed the requirements?")
sys.exit()
from notionparser import Parser
def main():
# set up argument parser
@ -78,7 +78,8 @@ def main():
log.addHandler(log_screen_handler)
log.propagate = False
try:
import colorama, copy
import colorama
import copy
LOG_COLORS = {
logging.DEBUG: colorama.Fore.GREEN,
@ -117,7 +118,7 @@ def main():
if urllib.parse.urlparse(args.target).scheme:
try:
response = requests.get(args.target)
if "notion.so" in args.target:
if "notion.so" in args.target or "notion.site" in args.target:
log.info("Initialising parser with simple page url")
config = {"page": args.target}
Parser(config=config, args=vars(args))