-
Notifications
You must be signed in to change notification settings - Fork 0
/
np.py
37 lines (31 loc) · 972 Bytes
/
np.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
import tweepy
import pylast
## replace with your twitter credientials
auth = tweepy.OAuthHandler("CONSUMER_KEY", "CONSUMER_SECRET")
auth.set_access_token("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET")
## replace with your credientials
lastfm_network = pylast.LastFMNetwork(
api_key = "XXX" ,
api_secret = "XXX",
)
## lastfm username
username = "XXX"
## status for not playing music
notplaying = "curretly not bumping jams"
## your twitter bio
bio = " "
## the text you displayed before your currently playing song
pretext = "Now playing: "
##########################
api = tweepy.API(auth)
now_playing = lastfm_network.get_user(username).get_now_playing()
nowplaying = pretext + str(now_playing)
updateactive = bio + nowplaying
updateinactive = bio + notplaying
if now_playing is None:
print(now_playing)
api.update_profile(description = updateinactive)
else:
print(notplaying)
api.update_profile(description = updateactive)