Cropinky commited on
Commit
36ec053
1 Parent(s): 08c9cd7

adding required files

Browse files
Files changed (49) hide show
  1. data/Lilgpt.txt +8 -0
  2. data/MFDOOM.txt +0 -0
  3. data/flowmasteri.txt +8 -0
  4. data/wutang.txt +11 -0
  5. data/ye.txt +1 -0
  6. data/zenske.txt +11 -0
  7. genius.py +38 -0
  8. songs/Lilgpt.txt +0 -0
  9. songs/Lilgpt/Boosie Badazz.txt +0 -0
  10. songs/Lilgpt/Lil Baby.txt +0 -0
  11. songs/Lilgpt/Lil Durk.txt +0 -0
  12. songs/Lilgpt/Lil Flip.txt +0 -0
  13. songs/Lilgpt/Lil Peep.txt +0 -0
  14. songs/Lilgpt/Lil Pump.txt +0 -0
  15. songs/Lilgpt/Lil Reese.txt +0 -0
  16. songs/Lilgpt/Lil Uzi Vert.txt +0 -0
  17. songs/Lilgpt/Lil Wayne.txt +0 -0
  18. songs/flowmasteri.txt +0 -0
  19. songs/flowmasteri/50 Cent.txt +0 -0
  20. songs/flowmasteri/Action Bronson.txt +0 -0
  21. songs/flowmasteri/Big L.txt +0 -0
  22. songs/flowmasteri/Big Pun.txt +0 -0
  23. songs/flowmasteri/ILL BILL.txt +0 -0
  24. songs/flowmasteri/Nas.txt +0 -0
  25. songs/flowmasteri/Prodigy of Mobb Deep.txt +0 -0
  26. songs/flowmasteri/The Notorious B.I.G..txt +0 -0
  27. songs/lyricstotxt.py +21 -0
  28. songs/wutang.txt +0 -0
  29. songs/wutang/Cappadonna.txt +0 -0
  30. songs/wutang/GZA.txt +0 -0
  31. songs/wutang/Ghostface Killah.txt +0 -0
  32. songs/wutang/Inspectah Deck.txt +0 -0
  33. songs/wutang/Masta Killa.txt +0 -0
  34. songs/wutang/Method Man.txt +0 -0
  35. songs/wutang/Ol’ Dirty Bastard.txt +0 -0
  36. songs/wutang/RZA.txt +0 -0
  37. songs/wutang/Raekwon.txt +0 -0
  38. songs/wutang/U-God.txt +0 -0
  39. songs/wutang/Wu-Tang Clan.txt +0 -0
  40. songs/ye.txt +0 -0
  41. songs/ye/Kanye West.txt +0 -0
  42. songs/zenske.txt +0 -0
  43. songs/zenske/Jean Grae.txt +0 -0
  44. songs/zenske/Lauryn Hill.txt +0 -0
  45. songs/zenske/Lil’ Kim.txt +0 -0
  46. songs/zenske/MC Lyte.txt +0 -0
  47. songs/zenske/Missy Elliott.txt +0 -0
  48. songs/zenske/Rah Digga.txt +0 -0
  49. songs/zenske/Remy Ma.txt +0 -0
data/Lilgpt.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Lil pump
2
+ Lil wayne
3
+ Lil Durk
4
+ Lil B
5
+ Lil Uzi Vert
6
+ Lil Baby
7
+ Lil Reese
8
+ Lil Boosie
data/MFDOOM.txt ADDED
File without changes
data/flowmasteri.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ The Notorious B.I.G.
2
+ Big Pun
3
+ Big L
4
+ Nas
5
+ 50 Cent
6
+ Prodigy
7
+ Action Bronson
8
+ Ill Bill
data/wutang.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Wu-Tang Clan
2
+ Raekwon
3
+ Ghostface Killah
4
+ RZA
5
+ GZA
6
+ Ol' Dirty Bastard
7
+ Method Man
8
+ Inspectah Deck
9
+ U-God
10
+ Masta Killa
11
+ Cappadonna
data/ye.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Kanye West
data/zenske.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Lauryn Hill
2
+ Jean Grae
3
+ Lil Kim
4
+ Missy Elliot
5
+ Rah Digga
6
+ MC Lyte
7
+ Remy Ma
8
+ Missy Elliott
9
+
10
+
11
+ Foxy Brown
genius.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from pathlib import Path
3
+ from unicodedata import name
4
+ import lyricsgenius
5
+ import sys
6
+ """
7
+ the data folder contains txt files with rapper's names, the songs folder contains all of the songs from a single group of artists
8
+ wutang.txt (10 members) - > wutang.txt 1 files with all of their songs.
9
+ """
10
+ ROOT_DIR = Path(os.path.dirname(os.path.abspath(__file__)))
11
+ #TODO: mulithreaded implemetation
12
+ class Genius:
13
+ def __init__(self, client_access_token, timeout, retries, songs_foldername = 'songs'):
14
+ self.songs_foldername = songs_foldername
15
+ self._api_ = lyricsgenius.Genius(client_access_token, timeout=timeout, retries=retries)
16
+ def scrape_artist(self, artist_name: str):
17
+ #you can pass a max_songs (or smth like that) parameter here to stop downloading songs after a certain number
18
+ artist = self._api_.search_artist(artist_name)
19
+ print(f"stvaram file {artist.name.strip()}")
20
+ f = open(Path(self.songs_foldername, f'{artist.name.strip()}.txt'), 'w')
21
+ for song in artist.songs:
22
+ f.write("\n" + '*'*50 + "\n")
23
+ f.write(song.title)
24
+ f.write(song.lyrics)
25
+ f.close()
26
+ print(f"done with {artist_name}")
27
+
28
+ #it loads rapper's names from the filename and then downloads all of their songs
29
+ filename = 'Lilgpt.txt'
30
+ songs_folder = Path(ROOT_DIR, 'songs', filename[:-4])
31
+ genius = Genius("you api key here :)", songs_foldername = songs_folder, timeout = 15, retries = 30)
32
+ try:
33
+ os.makedirs(songs_folder)
34
+ except:
35
+ pass #folder already exists irrelevant error tbh
36
+ with open(Path(ROOT_DIR, 'data', filename)) as f:
37
+ for rapper in [line.strip() for line in f.readlines()]:
38
+ genius.scrape_artist(rapper)
songs/Lilgpt.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Boosie Badazz.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Baby.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Durk.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Flip.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Peep.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Pump.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Reese.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Uzi Vert.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/Lilgpt/Lil Wayne.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/50 Cent.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/Action Bronson.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/Big L.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/Big Pun.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/ILL BILL.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/Nas.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/Prodigy of Mobb Deep.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/flowmasteri/The Notorious B.I.G..txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/lyricstotxt.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from pathlib import Path
3
+ import sys
4
+ foldername = sys.argv[1]
5
+ """
6
+ this script gives the text <bos> and <eos> tokens it could have all been one script but yeah
7
+ the foldername is passed and an argument when calling the script
8
+ """
9
+ header = ['text']
10
+ songsfile = open(foldername+'.txt', 'w', encoding='UTF8')
11
+ for _,_, files in os.walk(foldername):
12
+ for filename in files:
13
+ print(filename)
14
+ textsfile = open(Path(foldername, filename))
15
+ texts = textsfile.read()
16
+ texts = texts.split('*'*50)
17
+ texts = texts[1:]
18
+ for text in texts:
19
+ text_with_tokens = f"<BOS>{text}<EOS>\n"
20
+ #print(text_with_tokens)
21
+ songsfile.write(text_with_tokens)
songs/wutang.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Cappadonna.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/GZA.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Ghostface Killah.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Inspectah Deck.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Masta Killa.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Method Man.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Ol’ Dirty Bastard.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/RZA.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Raekwon.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/U-God.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/wutang/Wu-Tang Clan.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/ye.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/ye/Kanye West.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske/Jean Grae.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske/Lauryn Hill.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske/Lil’ Kim.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske/MC Lyte.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske/Missy Elliott.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske/Rah Digga.txt ADDED
The diff for this file is too large to render. See raw diff
 
songs/zenske/Remy Ma.txt ADDED
The diff for this file is too large to render. See raw diff