Skip to content

Instantly share code, notes, and snippets.

@maluta
Created December 16, 2013 20:56
Show Gist options
  • Save maluta/7994272 to your computer and use it in GitHub Desktop.
Save maluta/7994272 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding:utf-8 -*-
import re
import csv
tweets = csv.reader(open("tweets.csv"), delimiter=',', quotechar='"')
exp = 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
for tweet in tweets:
urls = re.findall(exp, tweet[5])
for url in urls:
if url != "":
print url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment