Created
May 10, 2018 23:47
-
-
Save Lvl4Sword/75fef5d0fd4f87ea3ccb863b2230a4ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import requests | |
import sys | |
band = None | |
user = None | |
counter = 0 | |
input_stripped = input('Input a band (or hit enter for user): ').strip() | |
if input_stripped == '': | |
input_stripped = input('Input a user: ').strip() | |
if input_stripped: | |
profile_request = requests.get('https://vampirefreaks.com/search/nav?term={0}'.format(input_stripped)) | |
json_profile = profile_request.json() | |
for each in json_profile: | |
if input_stripped.casefold() in json_profile[counter]['user_name'].casefold(): | |
profile_info = json_profile[counter] | |
user_name = json_profile[counter]['user_name'] | |
playlist_request = requests.get('https://vampirefreaks.com/playlist/get_json_playlist?playlist={0}'.format(user_name)) | |
user = True | |
break | |
counter += 1 | |
else: | |
profile_request = requests.get('https://vampirefreaks.com/search/bands?term={0}'.format(input_stripped)) | |
json_profile = profile_request.json() | |
for each in json_profile: | |
if input_stripped.casefold() == json_profile[counter]['band_name'].casefold(): | |
profile_info = json_profile[counter] | |
user_name = json_profile[counter]['user_name'] | |
playlist_request = requests.get('https://vampirefreaks.com/musicplayer/get_json_playlist?playlist={0}'.format(user_name)) | |
band = True | |
break | |
counter += 1 | |
if band is None and user is None: | |
print('Whatever you put in didn\'t work.') | |
print('Check your spelling and try again.') | |
sys.exit(0) | |
json_playlist = playlist_request.json() | |
print('\nPlaylist:') | |
counter = 0 | |
for each in json_playlist: | |
user_url = json_playlist[counter]['user_name'] | |
url_format = '/{0}/{1}/{2}/{3}/'.format(user_url[0], | |
user_url[0:2], | |
user_url[0:3], | |
user_url) | |
print('---------------------------') | |
print('{0} - {1}'.format(each['band_name'], each['song_name'])) | |
print('{0}{1}{2}.mp3'.format(each['url'].replace('http', 'https'), url_format, each['song_id'])) | |
counter += 1 | |
print('---------------------------') | |
print('\nInformation:') | |
if band: | |
if profile_info['record_label'] != '': | |
print('Record Label: {0}'.format(profile_info['record_label'])) | |
if int(profile_info['featured']): | |
print('Featured: True') | |
print('Fans: {0}'.format(profile_info['fans'])) | |
print('Username: {0}'.format(profile_info['user_name'])) | |
print('User ID: {0}'.format(profile_info['user_id'])) | |
if profile_info['user_sex'] != 'band': | |
print('User Sex: {0}'.format(profile_info['user_sex'])) | |
print('Picture: https:{0}'.format(profile_info['thumb'].rstrip('_s.jpg')) + '.jpg') | |
if profile_info['user_birthdate'] != '0000-00-00': | |
print('Birth Date: {0}'.format(profile_info['user_birthdate'])) | |
print('Points: {0}'.format(profile_info['user_ratingpoints'])) | |
print('Friends: {0}'.format(profile_info['num_friends'])) | |
print('Followers: {0}'.format(profile_info['num_followers'])) | |
# Not sure where this is generated from, considering some don't have this. | |
# From the smartphone app? Should probably check this. | |
if profile_info['lattitude'] not in ['0', 'None']: | |
print('Lattitude: {0}'.format(profile_info['lattitude'])) | |
if profile_info['longitude'] not in ['0', 'None']: | |
print('Longitude: {0}'.format(profile_info['longitude'])) | |
print('Country: {0}'.format(profile_info['user_country'])) | |
print('State: {0}'.format(profile_info['user_state'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment