-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#287 #294 #312 #320 #332 #335 #341 #343 #346 #355 #357 #360 #361 #362 #364 #365 #367 #370 #372 #374 #376 #377 #379 #380 #381 #382 #383 #393 #394 #397 #398 #399 #401 #402 #403 #404 #406 #407 #408 #410 #414 #416 #419 #420 #422 #423 #426 #431 #432 #433 #434 #435 #436 #437 #446 #448 #449 #450 #451 #452 #454 #455 #456 #567 #460 #466 #469 #470 #471 #472 #475 #476 #477 #480 #481 #483 #484 #485 1、全面升级aiohttp作为异步网络请求,asyncio为密集型IO 2、将导入的库做一个分类排序 3、新增昵称映射、登录、版本自定义模块 4、删除图集模块(现统一由Profile模块处理) 5、优化初始化控制台输出信息,由rich美化 6、偷懒欠了一屁股issues🥴 #155 #191 #202 #203 #206 #220 #226 #227 #243 #267 #287 #294 #312 #320 #332 #335 #341 #343 #346 #355 #357 #360 #361 #362 #364 #365 #367 #370 #372 #374 #376 #377 #379 #380 #381 #382 #383 #393 #394 #397 #398 #399 #401 #402 #403 #404 #406 #407 #408 #410 #414 #416 #419 #420 #422 #423 #426 #431 #432 #433 #434 #435 #436 #437 #446 #448 #449 #450 #451 #452 #454 #455 #456 #567 #460 #466 #469 #470 #471 #472 #475 #476 #477 #480 #481 #483 #484 #485
- Loading branch information
1 parent
bae15cf
commit d96c2d9
Showing
1 changed file
with
49 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ | |
@Description:__init__.py | ||
@Date :2022/07/29 23:20:56 | ||
@Author :JohnserfSeed | ||
@version :1.3.0.90 | ||
@License :(C)Copyright 2019-2022, Liugroup-NLPR-CASIA | ||
@version :1.4.0.0 | ||
@License :MIT License | ||
@Github :https://github.com/johnserf-seed | ||
@Mail :[email protected] | ||
------------------------------------------------- | ||
|
@@ -16,25 +16,37 @@ | |
------------------------------------------------- | ||
''' | ||
|
||
# 标准库 | ||
import re | ||
import io | ||
import os | ||
import sys | ||
import json | ||
import time | ||
import rich | ||
import math | ||
import signal | ||
import random | ||
import asyncio | ||
import logging | ||
import requests | ||
import platform | ||
import argparse | ||
import configparser | ||
import base64 | ||
from urllib import parse | ||
from urllib.request import urlopen | ||
from functools import partial | ||
from typing import Union, Optional | ||
from concurrent.futures import ThreadPoolExecutor | ||
from pathlib import Path | ||
|
||
# 第三方库 | ||
import aiohttp | ||
import requests | ||
|
||
from PIL import Image | ||
from lxml import etree | ||
from TikTokUpdata import Updata | ||
from functools import partial | ||
from threading import Event | ||
from urllib.request import urlopen | ||
import rich | ||
import qrcode | ||
from configobj import ConfigObj | ||
from rich.progress import ( | ||
BarColumn, | ||
DownloadColumn, | ||
|
@@ -44,54 +56,25 @@ | |
TimeRemainingColumn, | ||
TransferSpeedColumn, | ||
) | ||
from concurrent.futures import ThreadPoolExecutor | ||
from rich.console import Console | ||
from rich.table import Table | ||
from rich.panel import Panel | ||
|
||
# 自定义模块 | ||
from TikTokUpdata import Updata | ||
from .XB import XBogus | ||
from .Log import Log | ||
from .Urls import Urls | ||
from .Lives import Lives | ||
from .Check import CheckInfo | ||
from .Login import * | ||
from .Check import Check | ||
from .Config import Config | ||
from .Images import Images | ||
from .Command import Command | ||
from .Cookies import Cookies | ||
from .Profile import Profile | ||
from .Download import Download | ||
|
||
|
||
progress = Progress( | ||
TextColumn("{task.description}[bold blue]{task.fields[filename]}", justify="left"), | ||
BarColumn(bar_width=20), | ||
"[progress.percentage]{task.percentage:>3.1f}%", | ||
"•", | ||
DownloadColumn(), | ||
"•", | ||
TransferSpeedColumn(), | ||
"•", | ||
TimeRemainingColumn(), | ||
) | ||
|
||
done_event = Event() | ||
|
||
|
||
def handle_sigint(signum, frame): | ||
done_event.set() | ||
|
||
|
||
signal.signal(signal.SIGINT, handle_sigint) | ||
|
||
|
||
def copy_url(task_id: TaskID, url: str, name: str, path: str) -> None: | ||
response = urlopen(url) | ||
progress.update(task_id, total=int( | ||
response.info()["Content-length"])) | ||
with open(path, "wb") as dest_file: | ||
progress.start_task(task_id) | ||
for data in iter(partial(response.read, 32768), b""): | ||
dest_file.write(data) | ||
progress.update(task_id, advance=len(data)) | ||
if done_event.is_set(): | ||
return | ||
from .NickMapper import NickMapper | ||
from . import __version__ | ||
|
||
|
||
# 日志记录 | ||
|
@@ -120,15 +103,6 @@ def replaceT(obj): | |
return new | ||
|
||
|
||
def Status_Code(code: int): | ||
if code == 200: | ||
return | ||
else: | ||
log.info('[ 提示 ]:该视频%i,暂时无法解析!' % code) | ||
print('[ 提示 ]:该视频%i,暂时无法解析!' % code) | ||
return | ||
|
||
|
||
def reFind(strurl): | ||
""" | ||
匹配分享的url地址 | ||
|
@@ -145,50 +119,31 @@ def reFind(strurl): | |
return result | ||
|
||
|
||
print(''' | ||
████████╗██╗██╗ ██╗████████╗ ██████╗ ██╗ ██╗██████╗ ██████╗ ██╗ ██╗███╗ ██╗██╗ ██████╗ █████╗ ██████╗ | ||
╚══██╔══╝██║██║ ██╔╝╚══██╔══╝██╔═══██╗██║ ██╔╝██╔══██╗██╔═══██╗██║ ██║████╗ ██║██║ ██╔═══██╗██╔══██╗██╔══██╗ | ||
██║ ██║█████╔╝ ██║ ██║ ██║█████╔╝ ██║ ██║██║ ██║██║ █╗ ██║██╔██╗ ██║██║ ██║ ██║███████║██║ ██║ | ||
██║ ██║██╔═██╗ ██║ ██║ ██║██╔═██╗ ██║ ██║██║ ██║██║███╗██║██║╚██╗██║██║ ██║ ██║██╔══██║██║ ██║ | ||
██║ ██║██║ ██╗ ██║ ╚██████╔╝██║ ██╗██████╔╝╚██████╔╝╚███╔███╔╝██║ ╚████║███████╗╚██████╔╝██║ ██║██████╔╝ | ||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ | ||
''') | ||
table = Table.grid(padding=1, pad_edge=True) | ||
table.add_column(no_wrap=True, justify="left") | ||
table.add_row(__version__.__help__) | ||
|
||
|
||
console = Console(width=150) # 显示字符宽度 | ||
console = rich.console.Console(color_system="truecolor") # 真彩 | ||
console.print(f"{__version__.__logo__}", justify="center") | ||
console.print(f"\n:rocket: [bold]TikTokDownload [bright_yellow]{__version__.__version__}[/bright_yellow] :rocket:", justify="center") | ||
console.print(f":zap: [i]{__version__.__description_cn__} :zap:", justify="center") | ||
console.print(f":fire: [i]{__version__.__description_en__} :fire:", justify="center") | ||
console.print(f":computer: [i]Repo {__version__.__repourl__} :computer:\n", justify="center") | ||
console.print(Panel(table, border_style="bold", title="使用说明")) | ||
|
||
print("#" * 120) | ||
print( | ||
""" | ||
TikTokTool V1.3.0.90 | ||
使用说明: | ||
1、本程序目前支持命令行调用和配置文件操作,GUI预览版本已经发布 | ||
2、命令行操作方法:1)将本程序路径添加到环境变量 | ||
2)控制台输入 TikTokTool -u https://v.douyin.com/jqwLHjF/ | ||
3、配置文件操作方法:1)运行软件前先打开目录下 conf.ini 文件配置用户主页和音乐下载模式 | ||
2)按照控制台输出信息操作 | ||
4、如有您有任何bug或者意见反馈请在 https://github.com/Johnserf-Seed/TikTokDownload/issues 发起 | ||
5、GUI预览版本现已发布,操作更简单 https://github.com/Johnserf-Seed/TikTokDownload/tags 下载 | ||
6、TikTokLive 输入抖音直播间web端链接,例如 https://live.douyin.com/176819813905 | ||
7、新版工具fastdl正在开发中 ----> https://github.com/Johnserf-Seed/fastdl | ||
注意: 目前已经支持app内分享短链和web端长链识别。 | ||
""" | ||
) | ||
print("#" * 120) | ||
print('\r') | ||
|
||
if (platform.system() == 'Windows'): | ||
sprit = '\\' | ||
# 💻 | ||
print('[ 💻 ]:Windows平台') | ||
console.print('[ 💻 ]:Windows平台') | ||
elif (platform.system() == 'Linux'): | ||
sprit = '/' | ||
# 🐧 | ||
print('[ 🐧 ]:Linux平台') | ||
console.print('[ 🐧 ]:Linux平台') | ||
else: | ||
sprit = '/' | ||
# 🍎 | ||
print('[ 🍎 ]:MacOS平台') | ||
console.print('[ 🍎 ]:MacOS平台') | ||
|
||
|
||
# 检查版本 | ||
Updata().get_Updata() | ||
# 输出操作系统版本 | ||
log.info(platform.system()) |