<commit_before>import requests
# from bs4 import BeautifulSoup
from json import loads

def seek(chk_key, cur_epi):
    tepi = cur_epi+1
    chk_key = str(chk_key)

    season_id = chk_key
    # query_url = "http://www.bilibili.com/search?keyword=%s&orderby=&type=series&tids=&tidsC=&arctype=all&page=1" % (chk_key, )
    # html_content = requests.get(query_url).text
    # bs = BeautifulSoup(html_content, "html.parser")
    # s_bgmlist = bs.find('div', class_="s_bgmlist")
    # try:
        # season_id = s_bgmlist.get('data-seasonid')
    # except AttributeError:
        # return {}

    api_url = "http://app.bilibili.com/bangumi/seasoninfo/%s.ver?callback=episodeJsonCallback" % (season_id,)
    apiRes = requests.get(api_url).text
    apiRes = apiRes[20:]
    apiRes = apiRes[:-1]
    apiRes = loads(apiRes)
    epi_list = apiRes['result']['episodes']

    try:
        for epi in  epi_list:
            if epi['index'] == str(tepi):
                av_id = epi['av_id']
                av_page= epi['page']
                av_name = epi['index_title']<commit_msg>[Seeker] bilibili smart detect check key to be Series ID or search keyword for backward support.<commit_after>import requests
from bs4 import BeautifulSoup
from json import loads

def seek(chk_key, cur_epi):
    tepi = cur_epi+1
    chk_key = str(chk_key)

    try:
        int(chk_key)
    except ValueError:
        query_url = "http://www.bilibili.com/search?keyword=%s&orderby=&type=series&tids=&tidsC=&arctype=all&page=1" % (chk_key, )
        html_content = requests.get(query_url).text
        bs = BeautifulSoup(html_content, "html.parser")
        s_bgmlist = bs.find('div', class_="s_bgmlist")
        try:
            season_id = s_bgmlist.get('data-seasonid')
        except AttributeError:
            return {}
    else:
        season_id = chk_key

    api_url = "http://app.bilibili.com/bangumi/seasoninfo/%s.ver?callback=episodeJsonCallback" % (season_id,)
    apiRes = requests.get(api_url).text
    apiRes = apiRes[20:]
    apiRes = apiRes[:-1]
    apiRes = loads(apiRes)
    epi_list = apiRes['result']['episodes']

    try:
        for epi in  epi_list:
            if epi['index'] == str(tepi):
                av_id = epi['av_id']
                av_page= epi['page']
                av_name = epi['index_title']
{'fraction_non_alphanumeric': 0.1331309627059844, 'fraction_numerical': 0.005203816131830009, 'mean_word_length': 2.825870646766169, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2458802', 'n_tokens_mistral': 850, 'n_tokens_neox': 811, 'n_words': 145}