File size: 1,666 Bytes
973f016
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import json \n",
    "import requests \n",
    "  \n",
    "import streamlit as st \n",
    "from streamlit_lottie import st_lottie \n",
    "import os\n",
    "folder_path = \"lotte_animation_saver/\"\n",
    "\n",
    "# Get the list of all files in the folder\n",
    "file_names = os.listdir(folder_path)\n",
    "max_file_name=max([int(i.split(\"_\")[-1][:-5]) for i in file_names])  \n",
    "url = requests.get( \n",
    "    \"https://lottie.host/34b4b005-c8c9-4d57-a0fd-0e9ed3b49835/nCkgflSg9J.json\") \n",
    "# Creating a blank dictionary to store JSON file, \n",
    "# as their structure is similar to Python Dictionary \n",
    "url_json = dict() \n",
    "  \n",
    "if url.status_code == 200: \n",
    "\n",
    "    url_json = url.json() \n",
    "    with open(\"lotte_animation_saver/animation_\"+str(max_file_name+1)+\".json\",\"w\") as read:\n",
    "        json.dump(url_json,read,indent=2)\n",
    "\n",
    "else: \n",
    "    print(\"Error in the URL\") "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "env",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}