Created
November 1, 2017 22:48
-
-
Save jessienewell/f7d05e43a0a3286cd3b2f4d92263f57e to your computer and use it in GitHub Desktop.
This file contains 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
import re | |
def find_hastags(text): | |
return re.findall(r'#(\w+)', text) | |
hashtags = [] | |
#photos that I've recently liked | |
api.getLikedMedia() | |
result = api.LastJson | |
for r in tqdm(result['items']): | |
if r['caption'] is not None: | |
hashtag = find_hastags(r['caption']['text']) | |
#photos that i have been recently tagged in | |
api.getSelfUserTags() | |
result = api.LastJson | |
for r in result['items']: | |
if r['caption'] is not None: | |
hashtag = find_hastags(r['caption']['text']) | |
[hashtags.append(i.lower()) for i in hashtag] | |
top_hashtags = pd.Series(hashtags).value_counts()[:10] | |
print(top_hashtags.index) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment