Last active
August 29, 2015 14:07
-
-
Save nickedes/aeb1590e99de40fa136a to your computer and use it in GitHub Desktop.
extract links from a chat
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 json | |
from pprint import pprint | |
import re | |
with open('complete.pretty.json') as data_file: | |
data = json.load(data_file) | |
for i in range(0, len(data)): | |
url = data[i]['body'] | |
if (re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', url) ): | |
print data[i]['author'] | |
print re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment