From 4c9d04f17529702a00a5160e9401d557c9374664 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 14 Mar 2019 13:59:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=B8=8B=E6=92=AD?= =?UTF-8?q?=E5=90=8E=E6=97=A0=E6=B3=95=E6=8A=95=E7=A8=BF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bilibili.py | 2 ++ liveDownloader.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bilibili.py b/bilibili.py index 040387c..99f2898 100644 --- a/bilibili.py +++ b/bilibili.py @@ -309,6 +309,8 @@ class Bilibili: :param no_reprint: (optional) 0=可以转载, 1=禁止转载(default) :type no_reprint: int """ + if len(self.videos) == 0: + return self.session.headers['Content-Type'] = 'application/json; charset=utf-8' copyright = 2 if source else 1 r = self.session.post('https://member.bilibili.com/x/vu/web/add?csrf=' + self.csrf, diff --git a/liveDownloader.py b/liveDownloader.py index 2ed199d..b2e54ea 100644 --- a/liveDownloader.py +++ b/liveDownloader.py @@ -1,7 +1,6 @@ import sys import time from datetime import datetime -import m3u8 import queue import threading from config import config @@ -74,6 +73,7 @@ def download(url): path = datetime.strftime(datetime.now(), "%Y%m%d_%H%M.flv") p = requests.get(url, stream=True) if p.status_code != 200: + isUpload = True return True f = open(path, "ab") try: @@ -91,6 +91,7 @@ def download(url): print("{} : Download Daemon Quiting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"))) download(url) + def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")): print("{} : Upload Daemon Starting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"))) i = uq.get()