<commit_before>local simplehttp = require'simplehttp'
local json = require'json'

customHosts['^github%.com'] = function(queue, info)
    local query = info.query
    local path = info.path
    local fragment = info.fragment
    local repo

    local pattern = '/([%w-.]+/[%w-.]+)/?$'
    if(path and path:match(pattern)) then
        repo = path:match(pattern)
    end

    if repo then
        simplehttp(
            ('https://api.github.com/repos/%s'):format(repo),

            function(data)
                local info = json.decode(data)<commit_msg>github: improve pattern to not catch false positives<commit_after>local simplehttp = require'simplehttp'
local json = require'json'

customHosts['^github%.com'] = function(queue, info)
    local query = info.query
    local path = info.path
    local fragment = info.fragment
    local repo

    local pattern = '^/([%w-.]+/[%w-.]+)/?$'
    if(path and path:match(pattern)) then
        repo = path:match(pattern)
    end
    print (path, repo)

    if repo then
        simplehttp(
            ('https://api.github.com/repos/%s'):format(repo),

            function(data)
                local info = json.decode(data)
{'fraction_non_alphanumeric': 0.14042553191489363, 'fraction_numerical': 0.0, 'mean_word_length': 2.574468085106383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6863010', 'n_tokens_mistral': 358, 'n_tokens_neox': 348, 'n_words': 87}