-
Notifications
You must be signed in to change notification settings - Fork 3
/
getCBS.py
37 lines (24 loc) · 981 Bytes
/
getCBS.py
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
#!/usr/bin/python3
# Program to retrieve the latest CBS radio news as a file.
# The news URL changes hourly, but it is easy to work out:
# 27May2019 - changed timezone to Central. Since May 20th,
# bulletins have stepped back by an hour, and I don't
# know why.
import datetime, pytz
#, wget
PREFIX = "http://audio.cbsradionewsfeed.com/"
#RAW_DL = "CBS_raw.mp3"
#PART1_AUDIO = "CBS_part1.wav"
#PART2_AUDIO = "CBS_part2.wav"
#PART2_AUDIO_CUT = "CBS_part2-cut.wav"
#CBS_EDITED = "CBS_news.mka"
# Time, in seconds, where we start to look for the silence marking the end of bulletin.
#SPLIT = 240
est = datetime.datetime.now(pytz.timezone('US/Eastern'))
year = str(est.year)
month = "{:02}".format(est.month)
date = "{:02}".format(est.day)
hour = "{:02}".format(est.hour)
URL = year + '/' + month + '/' + date + '/' + hour + '/Hourly-' + hour + '.mp3'
# We need to get this URL, divide it into two, and search for the first silence in the second part.
print(PREFIX + URL)