Skip to content

Commit ce88491

Browse files
committed
Update
1 parent 9562cd0 commit ce88491

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ downloader = FantiaDownloader(output=".", key='your _session_id')
3636
downloader.getPostPhotos(12345)
3737
```
3838

39+
## `scraper_radiko.py`
40+
41+
Usage:
42+
43+
```python
44+
from scraper_radiko import RadikoExtractor
45+
46+
# It supports the following formats:
47+
# http://www.joqr.co.jp/timefree/mss.php
48+
# http://radiko.jp/share/?sid=QRR&t=20200822260000
49+
# http://radiko.jp/#!/ts/QRR/20200823020000
50+
url = 'http://www.joqr.co.jp/timefree/mss.php'
51+
52+
e = RadikoExtractor(url, save_dir='/output')
53+
e.parse()
54+
```
55+
3956
## `util.py`
4057

4158
Some utility functions mainly for myself. Read the code to get the idea. Some highlights:

scraper_radiko.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,11 @@ def parse(self, *args, **kwargs):
144144
e.submit(download, url, save_path=temp_folder)
145145

146146
files = [f for f in temp_folder.iterdir() if f.suffix.lower() == '.aac']
147-
my_str = ''
148-
for f in files:
149-
my_str += f"file '{f}'\n"
147+
my_str = '\n'.join(f"file '{f}'" for f in files)
150148
filelist = temp_folder / 'files.txt'
149+
filelist.write_text(my_str, encoding='utf-8')
150+
151151
temp_aac = temp_folder / 'temp.aac'
152-
with filelist.open('w', encoding='utf-8') as f:
153-
f.write(my_str)
154-
155152
# Concat in raw aac first, then remuxed in m4a container. Otherwise the duration in SOME software would be wrong. Don't ask me why..
156153
run(['ffmpeg', '-f', 'concat', '-safe', '0', '-i', filelist, '-c', 'copy', temp_aac], stdout=DEVNULL)
157154
run(['ffmpeg', '-i', temp_aac, '-c', 'copy', fullpath], stdout=DEVNULL)

0 commit comments

Comments
 (0)