Download songs using YouTube URL (#135)

* Download from YouTubr URL

* Slugify title only for YouTube URL's
This commit is contained in:
Ritiek Malhotra
2017-09-27 09:56:47 +05:30
committed by GitHub
parent 17e6d1fa2e
commit 97a8c21eb9
2 changed files with 25 additions and 9 deletions

View File

@@ -72,11 +72,16 @@ def get_arguments():
def is_spotify(raw_song):
"""Check if the input song is a Spotify link."""
if (len(raw_song) == 22 and raw_song.replace(" ", "%20") == raw_song) or \
(raw_song.find('spotify') > -1):
return True
else:
return False
status = len(raw_song) == 22 and raw_song.replace(" ", "%20") == raw_song
status = status or raw_song.find('spotify') > -1
return status
def is_youtube(raw_song):
"""Check if the input song is a YouTube link."""
status = len(raw_song) == 11 and raw_song.replace(" ", "%20") == raw_song
status = status and not raw_song.lower() == raw_song
status = status or 'youtube.com/watch?v=' in raw_song
return status
def sanitize_title(title):