This commit is contained in:
Lostecho
2023-07-13 10:09:11 +08:00
parent 3ce9c56909
commit a0825003e7
7 changed files with 352 additions and 362 deletions

26
getUrl.py Normal file
View File

@@ -0,0 +1,26 @@
# get all url and text
import json
import requests
from IPython.display import Audio,display
from pydub import AudioSegment
import os
# get pic url list
with open('audio.json', encoding= "UTF-8") as f:
audios = json.load(f)
# print(type(audios[1])) # Output: dict
course_id = str(audios[1]['course_id'])
# os.makedirs(course_id, exist_ok=True)
audio_list = []
for audio in audios:
category = audio['category']
if category == "PLAIN_IMAGE":
url = audio['attachment']['url']
print(url)
# with open( course_id + '_pic_url.txt', 'a') as file:
# file.write(url)
# file.write("\n")