forked from bitslabsyr/ArtInSocialMedia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
walk.py
35 lines (30 loc) · 1.07 KB
/
walk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import csv
import download
import time
import json
def downloadArtist(userID):
artistUrl='https://dribbble.com/{}'
artistHtml = download.download(artistUrl.format(userID))
if artistHtml != None:
with open(username + '.html', 'w') as outfile:
outfile.write(artistHtml)
def getName(username):
fileHandle = "/Users/YihanYu/Desktop/NetworkAnalysis/1000Users/Behance1000Users" + "//" + username + ".json"
json_data = open(fileHandle).read()
data = json.loads(json_data)
for i in data['user']['social_links']:
if i['service_name']=="Dribbble":
dribbblelink=i["url"]
print dribbblelink
behanceName = dribbblelink.replace("http://dribbble.com/", "")
print behanceName
return behanceName
readfile="/Users/YihanYu/PycharmProjects/ArtStation/Behance-Dribbble.csv"
with open(readfile) as csvfile:
reader = csv.DictReader(csvfile)
for line in reader:
username=line['username']
userID=getName(username)
print userID
downloadArtist(userID)
time.sleep(3)