test upload by biliup-rs
This commit is contained in:
1 parent
f515dd2ac7
commit
6c8230aa63
4 files changed
+81
-10
No files matched your search
+3
-1
@@ -23,4 +23,6 @@ archive.txt
|
||||
/node_modules
|
||||
watch_process.pid
|
||||
package-lock.json
|
||||
biliup/**/public
|
||||
biliup/**/public
|
||||
cookies.json
|
||||
*.log
|
||||
@@ -3,15 +3,7 @@ import os
|
||||
import random
|
||||
import time
|
||||
|
||||
import selenium.common
|
||||
from PIL import Image
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support import expected_conditions as ec
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
|
||||
from biliup.config import config
|
||||
from ..engine import Plugin
|
||||
@@ -21,6 +13,14 @@ from ..engine.upload import UploadBase, logger
|
||||
@Plugin.upload("bilibili")
|
||||
class BiliChrome(UploadBase):
|
||||
def __init__(self, principal, data):
|
||||
import selenium.common
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.support import expected_conditions as ec
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
super().__init__(principal, data, 'engine/bilibili.cookie')
|
||||
# self.title = title
|
||||
# self.date_title = None
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import time
|
||||
|
||||
import stream_gears
|
||||
|
||||
from ..engine import Plugin
|
||||
from ..engine.upload import UploadBase, logger
|
||||
|
||||
|
||||
@Plugin.upload(platform="biliup-rs")
|
||||
class BiliWeb(UploadBase):
|
||||
def __init__(
|
||||
self, principal, data, user, submit_api=None, copyright=2, postprocessor=None, dtime=None,
|
||||
dynamic='', lines='AUTO', threads=3, tid=122, tags=None, cover_path=None, description=''
|
||||
):
|
||||
super().__init__(principal, data, persistence_path='bili.cookie', postprocessor=postprocessor)
|
||||
if tags is None:
|
||||
tags = []
|
||||
self.user = user
|
||||
self.lines = lines
|
||||
self.submit_api = submit_api
|
||||
self.threads = threads
|
||||
self.tid = tid
|
||||
self.tags = tags
|
||||
self.cover_path = cover_path
|
||||
self.desc = description
|
||||
self.dynamic = dynamic
|
||||
self.copyright = copyright
|
||||
self.dtime = dtime
|
||||
|
||||
def upload(self, file_list):
|
||||
line = None
|
||||
if self.lines == 'kodo':
|
||||
line = stream_gears.UploadLine.Kodo
|
||||
elif self.lines == 'bda2':
|
||||
line = stream_gears.UploadLine.Bda2
|
||||
elif self.lines == 'ws':
|
||||
line = stream_gears.UploadLine.Ws
|
||||
elif self.lines == 'qn':
|
||||
line = stream_gears.UploadLine.Qn
|
||||
elif self.lines == 'cos':
|
||||
line = stream_gears.UploadLine.Cos
|
||||
elif self.lines == 'cos-internal':
|
||||
line = stream_gears.UploadLine.CosInternal
|
||||
tag = ','.join(self.tags)
|
||||
source = self.data["url"] if self.copyright == 2 else ""
|
||||
cover = self.cover_path if self.cover_path is not None else ""
|
||||
dtime = None
|
||||
if self.dtime:
|
||||
dtime = int(time.time() + self.dtime)
|
||||
stream_gears.upload(
|
||||
file_list,
|
||||
"cookies.json",
|
||||
self.data["format_title"][:80],
|
||||
self.tid,
|
||||
tag,
|
||||
self.copyright,
|
||||
source,
|
||||
self.desc,
|
||||
self.dynamic,
|
||||
cover,
|
||||
dtime,
|
||||
line,
|
||||
self.threads,
|
||||
)
|
||||
logger.info(f"上传成功: {self.principal}")
|
||||
return file_list
|
||||
+4
-1
@@ -10,7 +10,7 @@ keywords = ["bilibili douyu huya"]
|
||||
urls = {Homepage = "https://github.com/ForgQi/bilibiliupload"}
|
||||
requires-python = ">= 3.7"
|
||||
dependencies = [
|
||||
"selenium >= 3.8.1",
|
||||
"stream-gears >= 0.1.0",
|
||||
"psutil >= 5.4.6",
|
||||
"yt_dlp >= 2022.3.8.2",
|
||||
"Pillow >= 5.2.0",
|
||||
@@ -24,6 +24,9 @@ dependencies = [
|
||||
]
|
||||
dynamic = ["version"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
selenium = ["selenium >= 3.8.1"]
|
||||
|
||||
[project.readme]
|
||||
file = "README.md"
|
||||
content-type = "text/markdown"
|
||||
|
||||
Reference in new issue
Block a user