<jupyter_start><jupyter_text>Make it a funcition<jupyter_code>def get_songs(release_wiki):
    base = 'https://en.wikipedia.org' 
    page = requests.get(base+release_wiki)
    soup = BeautifulSoup(page.text,'html.parser')
    tracklist_table = soup.find_all("table", {"class":"tracklist"} )
    try:
        artists_lists = tracklist_table[0].find_all("td")
        i = list(map(lambda x : re.sub(r'<.*?>',' ',str(x) ),artists_lists))
        i = i[:(len(i)-(len(i)%5))]
        i2 = np.array(i).reshape(len(i)//5,5)
        return i2
    except:
        return "error"
get_songs('/wiki/Death_Before_Dishonor_(album)')
albums["songs_list"] = albums['release_wiki'].apply(get_songs)
type(albums["songs_list"][0])
albums.to_csv("songs_lists.csv",index=False)
albums["songs_list_error"] = albums["songs_list"].str.contains(r'[a-z]')
songs_list = albums[albums["songs_list_error"] != True]
songs_list = songs_list.drop(columns = ["songs_list_error"], axis=1)
songs_list.shape
songs_list.to_csv("albums_songs.csv",index=False)
def get_artists_songs(songs_list,name):
    r = songs_list[:,1]
    s = np.full((len(r)),name)
    l = np.asarray([r,s]).T
    return l
r = get_artists_songs(songs_list["songs_list"][0],"2 Chainz")
songs = songs_list.apply(lambda x: get_artists_songs(x["songs_list"], x["name"]), axis=1)
songs[0]
songs = np.vstack(songs)
songs = pd.DataFrame(songs, columns = ["track", "artist"])
songs.head()
songs.to_csv("songs.csv",index=False)
# get lyrics

page = requests.get(base+'/wiki/ColleGrove')
soup = BeautifulSoup(page.text,'html.parser')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18628067967275017, 'fraction_numerical': 0.008181246066708621, 'mean_word_length': 5.570247933884297, 'pattern_counts': {'":': 1, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 1, '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}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '656466', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 640, 'n_tokens_neox': 638, 'n_words': 83, 'path': 'wikipedia_crawling/wikipedia_get_songs.ipynb', 'repo_name': 'crawftv/music_recommender', 'size': '1589'}