cynika commited on
Commit
4675404
·
1 Parent(s): 970b3d9
Files changed (1) hide show
  1. nft.py +1 -20
nft.py CHANGED
@@ -51,25 +51,6 @@ def get_image_type(file_path):
51
  return imghdr.what(None, data)
52
 
53
 
54
- def upload_image(file_path, ACCESS_KEY):
55
- url = "https://api.bilibili.com/x/upload/app/image?access_key=" + ACCESS_KEY
56
-
57
- payload = {'bucket': 'medialist', 'dir': 'nft'}
58
-
59
- with open(file_path, 'rb') as f:
60
- type = f'image/{imghdr.what(f)}'
61
- print(type)
62
- files = [
63
- (
64
- 'file',
65
- (file_path, f, type),
66
- )
67
- ]
68
- response = requests.request("POST", url, data=payload, files=files)
69
- print(response.text)
70
- return response.json()['data']['location']
71
-
72
-
73
  def get_one_card_id(UID, ACCESS_KEY):
74
  url = "https://api.bilibili.com/x/vas/nftcard/cardlist"
75
  params = SingableDict(
@@ -94,7 +75,7 @@ def get_one_card_id(UID, ACCESS_KEY):
94
  print(f"已将卡片信息写入 {CARD_INFO_PATH}")
95
  for round in data['data']['round_list']:
96
  for card in round['card_list']:
97
- if card['card_type'] == 1 and card['card_id_list']:
98
  print(card['card_id_list'][0]['card_id'])
99
  return card['card_id_list'][0]['card_id']
100
  print('没有 R 级别胶囊计划的卡片')
 
51
  return imghdr.what(None, data)
52
 
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  def get_one_card_id(UID, ACCESS_KEY):
55
  url = "https://api.bilibili.com/x/vas/nftcard/cardlist"
56
  params = SingableDict(
 
75
  print(f"已将卡片信息写入 {CARD_INFO_PATH}")
76
  for round in data['data']['round_list']:
77
  for card in round['card_list']:
78
+ if card['card_type'] == 2 and card['card_id_list']:
79
  print(card['card_id_list'][0]['card_id'])
80
  return card['card_id_list'][0]['card_id']
81
  print('没有 R 级别胶囊计划的卡片')