Procházet zdrojové kódy

coinmarketcap欄位修改

Mike před 3 roky
rodič
revize
aeb8db3662
2 změnil soubory, kde provedl 7 přidání a 7 odebrání
  1. 3 3
      api/main.py
  2. 4 4
      index.html

+ 3 - 3
api/main.py

@@ -48,7 +48,8 @@ class ContactUs(BaseModel):
 
 @app.get("/showdata/{limit}")
 async def showdata(limit):
-    url = 'https://api.coinmarketcap.com/data-api/v3/nft/collections?start=0&limit=' + limit
+    # url = 'https://api.coinmarketcap.com/data-api/v3/nft/collections?start=0&limit=' + limit
+    url = 'https://api.coinmarketcap.com/data-api/v3/nft/collections?start=0&limit=' + limit + '&sort=volume&desc=true&period=2'
     r = urllib.request.urlopen(url)
     collections = json.loads(r.read())['data']['collections']
     
@@ -56,9 +57,8 @@ async def showdata(limit):
 
     for req in collections:
         logo = 'https://s3.coinmarketcap.com/generated/nft/collections/' + req['slug'] + '.png';
-        last_7_days = 'https://s3.coinmarketcap.com/generated/sparklines/nft/collection/web/30d/' + req['slug'] +'.png';
 
-        reqs.append({'rank':req['rank'],'slug':req['slug'],'logo':logo,'website':req['website'],'name':req['name'],'assets':req['assets'],'collection_net_worth':req['netWorth'],'volume_7d':req['volume7d'],'sales_7d':req['sales7d'],'volume_all_time':req['volumeAT'],'sales_all_time':req['salesAT'],'last_7_days':req['sales7d']})
+        reqs.append({'rank':req['rank'],'slug':req['slug'],'logo':logo,'website':req['website'],'name':req['name'],'assets':req['assets'],'collection_net_worth':req['netWorth'],'volume_7d':req['volume7d'],'sales_7d':req['sales7d'],'volume_all_time':req['volumeAT'],'sales_all_time':req['salesAT'],'owners':req['owners']})
     return reqs
 
 @app.post("/add_sub")

+ 4 - 4
index.html

@@ -3993,7 +3993,7 @@
                         <th scope="col">Sales(7d)</th>
                         <th scope="col">Volume(All Time)</th>
                         <th scope="col">Sales(All Time)</th>
-                        <th scope="col">Last 7 Days</th>
+                        <th scope="col">Owners</th>
                     </tr>
                 </thead>
                 <tbody id="pc">
@@ -4021,7 +4021,7 @@
                         <th scope="col">#</th>
                         <th scope="col">Name</th>
                         <th scope="col">Assets</th>
-                        <th scope="col">Last 7 Days</th>
+                        <th scope="col">Networth</th>
                     </tr>
                 </thead>
                 <tbody id="mobile">
@@ -4188,7 +4188,7 @@
                                 <th scope="row">' + r[i].rank + '</th> \
                                 <td><a href="' + r[i].website + '" target="_blank" style="text-decoration: none;color:black;"><img class="me-2 img-fluid" src="' + r[i].logo + '" alt="' + r[i].name + '">' + r[i].name + '</a></td> \
                                 <td>' + r[i].assets + '</td> \
-                                <td><img class="data-line" src="' + r[i].last_7_days + '" alt="' + r[i].name + '"></td> \
+                                <td>' + r[i].collection_net_worth + '</td> \
                             </tr>';
 
                         pc_temp += ' \
@@ -4201,7 +4201,7 @@
                                 <td>' + r[i].sales_7d + '</td> \
                                 <td>' + r[i].volume_all_time + '</td> \
                                 <td>' + r[i].sales_all_time + '</td> \
-                                <td><img class="data-line" src="' + r[i].last_7_days + '" alt="' + r[i].name + '"></td> \
+                                <td>' + r[i].owners + '</td> \
                             </tr>';
                     }