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 os
import sys import sys
import logging import logging
@ -11,11 +12,10 @@ try:
import requests import requests
import toml import toml
except ModuleNotFoundError as error: 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() sys.exit()
from notionparser import Parser
def main(): def main():
# set up argument parser # set up argument parser
@ -78,7 +78,8 @@ def main():
log.addHandler(log_screen_handler) log.addHandler(log_screen_handler)
log.propagate = False log.propagate = False
try: try:
import colorama, copy import colorama
import copy
LOG_COLORS = { LOG_COLORS = {
logging.DEBUG: colorama.Fore.GREEN, logging.DEBUG: colorama.Fore.GREEN,
@ -117,7 +118,7 @@ def main():
if urllib.parse.urlparse(args.target).scheme: if urllib.parse.urlparse(args.target).scheme:
try: try:
response = requests.get(args.target) 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") log.info("Initialising parser with simple page url")
config = {"page": args.target} config = {"page": args.target}
Parser(config=config, args=vars(args)) Parser(config=config, args=vars(args))