INNER CODE UNIT · Python

get_words

balta2ar/brotab · brotab/main.py:288

def get_words(args):
    # return tab.execute({javascript: "
    # [...new Set(document.body.innerText.match(/\w+/g))].sort().join('\n');
    # "})
    start = time.time()
    brotab_logger.info('Get words from tabs: %s, match_regex=%s, join_with=%s',
                       args.tab_ids, args.match_regex, args.join_with)
    api = MultipleMediatorsAPI(create_clients(args.target_hosts))
    words = api.get_words(args.tab_ids, args.match_regex, args.join_with)
    print('\n'.join(words))
    delta = time.time() - start
    # print('DELTA TOTAL', delta, file=sys.stderr)


def get_text_or_html(getter, args):
    tabs = getter([], args.delimiter_regex, args.replace_with)
    re_match_tabs = re.compile('|'.join(['^%s\t' % tab for tab in args.tab_ids]))
    tabs = [tab for tab in tabs if re_match_tabs.match(tab)]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…