from datetime import datetime

from functions import add_to_output, test_url, get_author
import functions

# URL to find
url_to_find = ''
if not url_to_find:
    add_to_output('URL to find: matches any URL')
else:
    add_to_output('URL to find: ' + url_to_find)
# allow partial matches for URL?
exact_URL_match = False
exact_URL_beginning = False
add_to_output('Exact URL matching? ' + str(exact_URL_match))
add_to_output('Exact URL beginning? ' + str(exact_URL_beginning))

# when testing for broken links the requested response of the
# matched URL pages can considerably slow down the search;
# make sure you set stricter search filters and
# don't abuse it, target websites may not like it, even if we don't scrape anything
test_broken_links = True
add_to_output('Test for broken links? ' + str(test_broken_links))
# set tineout in seconds before the test_url function def (in functions.py)
if test_broken_links:
    tested_urls = []
    add_to_output('Test broken links timeout: ' + str(functions.TEST_BROKEN_LINKS_TIMEOUT))

# FILTERS

# filter posts by number
from beem.account import Account
import json, re
from datetime import datetime

from dotenv import load_dotenv
load_dotenv()

from functions import add_to_output, test_url, set_author
import functions

# script parameters
# =================

# Steem/Hive node
NODE = 'https://anyx.io'  #'https://api.steemit.com'
add_to_output('Node used: ' + NODE)
# change this based on the node used
interface_to_open_posts = 'https://peakd.com'  #'https://steempeak.com' # don't include ending "/"
print('Interface to open posts: ' + interface_to_open_posts)

s = Steem(node=NODE, keys=[os.getenv('keys')])

# author
author_name = 'gadrian'
set_author(author_name)
add_to_output('Author username: ' + author_name)

acc = Account(author_name, steem_instance=s)

# import only one settings file at a time
#