Skip to content

Instantly share code, notes, and snippets.

@blixt
Created July 18, 2014 19:55
Show Gist options
  • Save blixt/b3f5d4df6a28ed60a1e4 to your computer and use it in GitHub Desktop.
Save blixt/b3f5d4df6a28ed60a1e4 to your computer and use it in GitHub Desktop.
import json
import re
with open('hashtag-shares.json') as f:
rows = f.readlines()
hashtags = dict()
for row in rows:
share = json.loads(row)
for tag in re.findall(r'#\w+', share['message']):
hashtag = hashtags.setdefault(tag.lower(), dict(tracks=[]))
hashtag['tracks'].append(share['resource'])
for hashtag, data in hashtags.iteritems():
print hashtag
for track in data['tracks']:
print '- %s' % track
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment