hotfix this ytdl merging bullshit
This commit is contained in:
parent
139fe5b963
commit
9d7ea2d701
1 changed files with 6 additions and 2 deletions
8
robot.py
8
robot.py
|
@ -3,6 +3,7 @@ import logging
|
|||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from glob import glob
|
||||
|
||||
import requests
|
||||
import youtube_dl
|
||||
|
@ -35,14 +36,17 @@ def datestr(date):
|
|||
def download_ydl(urls, date):
|
||||
ydl_opts = {
|
||||
'noplaylist': True,
|
||||
'restrictfilenames': True,
|
||||
'download_archive': DIR + '/downloaded.lst',
|
||||
'outtmpl': TMP_DIR + '/' + datestr(date) + '__%(title)s__%(id)s.%(ext)s'
|
||||
}
|
||||
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
||||
ydl.download(urls)
|
||||
for filename in map(ydl.prepare_filename, map(ydl.extract_info, urls)):
|
||||
logger.info("Moving %s to %s..." % (filename, OUT_DIR))
|
||||
shutil.move(filename, OUT_DIR)
|
||||
globbeds = glob(os.path.splitext(filename)[0] + '.*')
|
||||
for globbed in globbeds:
|
||||
logger.info("Moving %s to %s..." % (globbed, OUT_DIR))
|
||||
shutil.move(globbed, OUT_DIR)
|
||||
|
||||
|
||||
def download_raw(url, date):
|
||||
|
|
Loading…
Reference in a new issue