Compare commits

...
3 Commits
Author SHA1 Message Date
ilusha 37f9314312 except pass 2022-03-23 16:32:51 +03:00
ilusha a2df050dcb fix nonetype 2022-03-23 11:16:01 +03:00
ilusha e8761e38ac fuck newline 2022-03-21 21:29:41 +03:00
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -95,7 +95,7 @@ def get_video_info(link: str) -> CoubVideo:
info = get_json_from_page(data)
try:
title = link.split("/view/")[-1] + "_" + "".join(x for x in info.get('title') if (x.isalnum() or x in "._- "))
title = link.split("/view/")[-1].replace('\n', '') + "_" + "".join(x for x in info.get('title') if (x.isalnum() or x in "._- "))
video = info['file_versions']['html5']['video']
video = video.get('higher') or video.get('high')
audio = info['file_versions']['html5'].get('audio')
@@ -156,8 +156,8 @@ def download_video(video: CoubVideo):
print(video.title)
save(http_get(video.video_url).content, video.title, "mp4")
save(http_get(video.audio_url).content, video.title, "mp3")
if video.audio_url:
save(http_get(video.audio_url).content, video.title, "mp3")
execute_ffmpeg(video.title)
else:
shutil.copy(f"{settings.TEMP_DIR}/{video.title}.mp4", f"{settings.OUT_DIR}/{video.title}.mp4")
+3
View File
@@ -37,7 +37,10 @@ for video in videos:
print("Removing temporary files...")
for item in os.listdir(settings.TEMP_DIR):
try:
os.remove(item)
except:
pass
print("Done.")