-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_testing_disect.py
103 lines (84 loc) · 2.66 KB
/
read_testing_disect.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import os
import json
import unicodecsv
from opensea_rankings_crawler import opensea_rankings_crawler
data = {}
files = os.listdir("testing/")
dict_keys = (['editors',
'payment_tokens',
'primary_asset_contracts',
'traits',
'stats',
'banner_image_url',
'chat_url',
'created_date',
'default_to_fiat',
'description',
'dev_buyer_fee_basis_points',
'dev_seller_fee_basis_points',
'discord_url',
'display_data',
'external_url',
'featured',
'featured_image_url',
'hidden',
'safelist_request_status',
'image_url',
'is_subject_to_whitelist',
'large_image_url',
'medium_username',
'name',
'only_proxied_transfers',
'opensea_buyer_fee_basis_points',
'opensea_seller_fee_basis_points',
'payout_address',
'require_email',
'short_description',
'slug',
'telegram_url',
'twitter_username',
'instagram_username',
'wiki_url',
'is_nsfw'])
total_skip = 0
skip = 0
for file in files:
with open("testing/" + file, 'r') as f:
dict = json.load(f)
#print (file)
try:
dict = dict['collection']
except:
print(file)
continue
#print ( dict['name'])
#print(dict.keys())
keys = ['name','instagram_username','twitter_username','telegram_url','discord_url','medium_username','external_url','editors','stats','image_url','banner_image_url','description']# ,'payout_address']
nft = {}
if not dict['stats']['total_sales']:
continue
total_skip+=1
if not dict['external_url']:
continue
print ("Yay found external_url !! => ", dict['external_url'])
skip+=1
#if not dict['image_url']:
# continue
#else:
# print (dict['image_url'])
for key in keys:
if dict[key]:
#print (key, dict[key])
#print (key,'._=> ',dict[key])
nft[key] = dict[key]
#print( 'https://medium.com/@'+dict[key].rstrip())
else:
nft[key] = ''
nft['slug'] = file
nft['opensea_url'] = "https://opensea.io/collection/" + file
data[file] = nft
with open("ztest.json","w") as f:
json.dump(data,f)
f.close()
print (skip,total_skip, ' out of ',len(files))
print (len(data))