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