Spaces:
Sleeping
Sleeping
Update functions.py
Browse files- functions.py +9 -2
functions.py
CHANGED
@@ -31,20 +31,27 @@ def load_whisper_api(audio):
|
|
31 |
return transcript
|
32 |
|
33 |
@st.cache_data
|
34 |
-
def get_transcribe_podcast(rss_url, local_path):
|
35 |
|
36 |
st.info("Starting Podcast Transcription Function...")
|
37 |
print("Feed URL: ", rss_url)
|
38 |
print("Local Path:", local_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
# Download the podcast episode by parsing the RSS feed
|
41 |
p = Path(local_path)
|
|
|
42 |
|
43 |
st.info("Downloading the podcast episode...")
|
44 |
|
45 |
episode_name = "podcast_episode.mp3"
|
46 |
|
47 |
-
with requests.get(
|
48 |
r.raise_for_status()
|
49 |
episode_path = p.joinpath(episode_name)
|
50 |
print(f'episode path {episode_path}')
|
|
|
31 |
return transcript
|
32 |
|
33 |
@st.cache_data
|
34 |
+
def get_transcribe_podcast(rss_url, local_path='podcast'):
|
35 |
|
36 |
st.info("Starting Podcast Transcription Function...")
|
37 |
print("Feed URL: ", rss_url)
|
38 |
print("Local Path:", local_path)
|
39 |
+
|
40 |
+
intelligence_feed = feedparser.parse(rss_url)
|
41 |
+
|
42 |
+
for item in intelligence_feed.entries[0].links:
|
43 |
+
if (item['type'] == 'audio/mpeg'):
|
44 |
+
episode_url = item.href
|
45 |
|
46 |
# Download the podcast episode by parsing the RSS feed
|
47 |
p = Path(local_path)
|
48 |
+
p.mkdir(exist_ok=True)
|
49 |
|
50 |
st.info("Downloading the podcast episode...")
|
51 |
|
52 |
episode_name = "podcast_episode.mp3"
|
53 |
|
54 |
+
with requests.get(episode_url, stream=True) as r:
|
55 |
r.raise_for_status()
|
56 |
episode_path = p.joinpath(episode_name)
|
57 |
print(f'episode path {episode_path}')
|