Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions username/username_profilepic.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ def extracting(imglinks, username, prourl, tag, attribute, value, finattrib, pro
res = requests.get(prourl)
soup = BeautifulSoup(res.content, "lxml")
img = soup.find(tag, {attribute: value})
if profile == "ask.fm":
img[finattrib] = "http:" + img[finattrib]
imglinks.append(img[finattrib])
path = "profile_pic/" + username + "/" + profile + ".jpg"
urllib.urlretrieve(img[finattrib], path)
else:
imglinks.append(img[finattrib])
path = "profile_pic/" + username + "/" + profile + ".jpg"
urllib.urlretrieve(img[finattrib], path)
try:
if profile == "ask.fm":
img[finattrib] = img[finattrib]
imglinks.append(img[finattrib])
path = "profile_pic/" + username + "/" + profile + ".jpg"
urllib.urlretrieve(img[finattrib], path)
else:
imglinks.append(img[finattrib])
path = "profile_pic/" + username + "/" + profile + ".jpg"
urllib.urlretrieve(img[finattrib], path)
except TypeError as e:
colored(style.BOLD + '[!] Error: ' + str(e) + '.\n' + style.END, 'red')
return imglinks


Expand Down
14 changes: 11 additions & 3 deletions username/username_twitterdetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ def twitterdetails(username):

f = open("temptweets.txt", "w+")
# writing tweets to temp file- last 1000
for tweet in tweepy.Cursor(api.user_timeline, id=username).items(1000):
f.write(tweet.text.encode("utf-8"))
f.write("\n")
try:
for tweet in tweepy.Cursor(api.user_timeline, id=username).items(1000):
f.write(tweet.text.encode("utf-8"))
f.write("\n")
except tweepy.error.TweepError as e:
if '401' in e.message:
print colored(style.BOLD +
'[!] Error: API Keys are invalid or Twitter account set to private.\n'
+ style.END, 'red')
else:
print colored(style.BOLD + '[!] Error: ' + str(e) + '.\n' + style.END, 'red')

# extracting hashtags
f = open('temptweets.txt', 'r')
Expand Down