Created
November 2, 2017 14:21
-
-
Save astrotars/45560a6a4587333a9a59e1acf78edd61 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