Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ pageopen.pyc
songs.pyc
wordsearch.pyc
pagination.pyc
pygenius.egg-info/
__init__.pyc
setup.py
src/README
src/MANIFEST.in
src/pygenius.egg-info
src/build
src/dist

.DS_Store
*.swp
*.swo
*~
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ OR

If you download the source from here, please make sure you have BeautifulSoup installed (`pip install beautifulsoup4`).

Or, to install from source:

$ cd src
$ python setup.py install

###To import the library

At the top of your script, include the following:

`from pygenius import artists, songs, wordsearch`



###Functions currently available
**artists.albumList(artist, arg)**
Returns a list of albums that the specified artist has recorded.
Expand Down
2 changes: 1 addition & 1 deletion src/pygenius/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def openPage(artist):
pages = pages.split('</a>')

pageLink = pages[len(pages) - 3]
pageLink = pageLink.replace('<a href="', 'http://rapgenius.com')
pageLink = pageLink.replace('<a href="', 'http://genius.com')
pageLink = pageLink.split('"')[0]
pageLink = pageLink.strip()

Expand Down
8 changes: 4 additions & 4 deletions src/pygenius/songs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def searchURL(url, arg='data'):
#lyric = ' '.join(lyric.split())
annotation = a.group(0)
#print lyric

lyrics.append(lyric)

search1 = annotation.find('"no_annotation"')
Expand All @@ -48,7 +48,7 @@ def searchURL(url, arg='data'):
elif search2 != -1:
annotation = re.sub(r'\<.*?\/', '', annotation)
annotation = annotation.replace('">', '')
annotations.append('http://rapgenius.com/' + annotation)
annotations.append('http://' + annotation)
else:
annotations.append("Not annotated")

Expand Down Expand Up @@ -100,7 +100,7 @@ def findAllSongs(artist, arg='songs'):
newUrl = pagination.openPage(artist)
songs = pagination.getSongs(newUrl)


for song in songs:
link = song[0]
track = song[1]
Expand All @@ -115,4 +115,4 @@ def findAllSongs(artist, arg='songs'):
return tracks
else:
return songs

4 changes: 4 additions & 0 deletions src/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
17 changes: 17 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from setuptools import setup

setup(name='pygenius',
version='2.0',
description='Python module for collecting data from rap songs.',
packages=['pygenius'],
author='Roopa Vasudevan',
author_email='roopa.vasudevan@gmail.com',
install_requires=[
'beautifulsoup4==4.1.3',
],
classifiers=['Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'License :: Freely Distributable',
'Natural Language :: English']
)