<commit_before>from urllib2 import urlopen
import os
import pickle
from CORE_DATA import directory,no_absolute_paths
global did_tell, no_absolute_paths
no_absolute_paths = True
did_tell = False
def YTCV4(youtube_url,cache=1,debug=0):
    global did_tell, no_absolute_paths
    Do_not_open = True
    __doc__ = "Cache does not affect anything, it's legacy for skibot."
    try:
        cut_down = youtube_url.split("watch?v=")[1].split("&")[0]
        if len(cut_down) > 11: #Longer than normal, presume troll.
            youtube_url.replace(cut_down,cut_down[:11])
        elif len(cut_down) < 11: #Shorter than normal
            pass
    except IndexError:
        return "Reflex: Where's the watch?v=?"
    first_two = cut_down[0:2]
    try:
        if no_absolute_paths:
            tiedosto = open("YTCache/"+first_two+".tcc","r")
        else:
            tiedosto = open(directory+"YTCache/"+first_two+".tcc","r")
    except:
        prev_dict = {}
    else:
        try:
            prev_dict = pickle.load(tiedosto)
        except EOFError: # Cache is corrupt
            os.remove(directory+"/nano/"+tiedosto.name)
            print "REMOVED CORRUPT CACHE: "+tiedosto.name
            prev_dict = {}
        tiedosto.close() # I think this should belong here.
        if cut_down in prev_dict.keys():
            return prev_dict[cut_down]
        else:
            pass<commit_msg>Quick fix for a bot-crashing issue resolving youtube links due to what I assume was a directory typo<commit_after>from urllib2 import urlopen
import os
import pickle
from CORE_DATA import directory,no_absolute_paths
global did_tell, no_absolute_paths
no_absolute_paths = True
did_tell = False
def YTCV4(youtube_url,cache=1,debug=0):
    global did_tell, no_absolute_paths
    Do_not_open = True
    __doc__ = "Cache does not affect anything, it's legacy for skibot."
    try:
        cut_down = youtube_url.split("watch?v=")[1].split("&")[0]
        if len(cut_down) > 11: #Longer than normal, presume troll.
            youtube_url.replace(cut_down,cut_down[:11])
        elif len(cut_down) < 11: #Shorter than normal
            pass
    except IndexError:
        return "Reflex: Where's the watch?v=?"
    first_two = cut_down[0:2]
    try:
        if no_absolute_paths:
            tiedosto = open("YTCache/"+first_two+".tcc","r")
        else:
            tiedosto = open(directory+"YTCache/"+first_two+".tcc","r")
    except:
        prev_dict = {}
    else:
        try:
            prev_dict = pickle.load(tiedosto)
        except EOFError: # Cache is corrupt
            os.remove(directory+tiedosto.name)
            print "REMOVED CORRUPT CACHE: "+tiedosto.name
            prev_dict = {}
        tiedosto.close() # I think this should belong here.
        if cut_down in prev_dict.keys():
            return prev_dict[cut_down]
        else:
            pass
{'fraction_non_alphanumeric': 0.1005586592178771, 'fraction_numerical': 0.009776536312849162, 'mean_word_length': 2.585732165206508, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2582904', 'n_tokens_mistral': 950, 'n_tokens_neox': 914, 'n_words': 226}