⚙️Add Keywords and Fix bugs

This commit is contained in:
Evil0ctal 2022-12-21 22:36:58 -08:00
parent e30e2a9fc8
commit 37ebd87f6e
2 changed files with 41 additions and 31 deletions

View File

@ -94,10 +94,10 @@ Web_Title = TikTok/抖音无水印在线解析下载
Web_Title_English = Douyin/TikTok online parsing and download without watermark Web_Title_English = Douyin/TikTok online parsing and download without watermark
# 网页描述 # 网页描述
Web_Description = 在线批量无水印解析抖音/TikTok视频及图文无水印下载,抖音无水印快捷指令,TikTok无水印快捷指令,抖音无水印API,TikTok no watermark API,抓取官方数据接口,稳定,开源,免费,无广告。 Web_Description = 在线批量解析TikTok/抖音视频和图片,支持无水印下载,官方数据接口,稳定,开源,免费,无广告。
# Web Description English # Web Description English
Web_Description_English = Online batch watermark-free parsing of Douyin/TikTok videos and text-free download, Douyin no watermark shortcut, TikTok no watermark shortcut, Douyin no watermark API, TikTok no watermark API, grab official data interface, stable, open source, free, no ads. Web_Description_English = Online batch parsing of TikTok/Douyin videos and pictures, support for no watermark download, official data interface, stable, open source, free, no ads.
# 网页关键词/Keywords of the web page # 网页关键词/Keywords of the web page
Keywords = douyin.wtf,evil0ctal,抖音,无水印,抖音无水印,抖音去水印,抖音无水印下载,下载,在线解析,抖音去水印在线,最新抖音无水印,tiktok,douyin,tiktok photo,picture,tiktok no watermark,no watermark,without watermark,watermark,downloader,online,free,tool Keywords = 抖音,tiktok,水印,无水印,no-watermark,抖音去水印,tiktok no watermark,在线,online,api,快捷指令,shortcut,下载,解析,parsing,tiktok api,抖音api,抖音去水印在线,tiktok去水印在线,downloader,下载器,free api,免费api

View File

@ -2,7 +2,7 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# @Author: https://github.com/Evil0ctal/ # @Author: https://github.com/Evil0ctal/
# @Time: 2021/11/06 # @Time: 2021/11/06
# @Update: 2022/12/16 # @Update: 2022/12/21
# @Function: # @Function:
# 用于在线批量解析Douyin/TikTok的无水印视频/图集。 # 用于在线批量解析Douyin/TikTok的无水印视频/图集。
# 基于 PyWebIO将scraper.py返回的内容显示在网页上。 # 基于 PyWebIO将scraper.py返回的内容显示在网页上。
@ -19,7 +19,6 @@ from pywebio.input import *
from pywebio.output import * from pywebio.output import *
from pywebio.session import info as session_info, run_asyncio_coroutine from pywebio.session import info as session_info, run_asyncio_coroutine
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('config.ini', encoding='utf-8') config.read('config.ini', encoding='utf-8')
@ -73,8 +72,8 @@ def error_do(reason: str, value: str) -> None:
'Entered the wrong link (the home page link is not supported for parsing with API-V1)')) 'Entered the wrong link (the home page link is not supported for parsing with API-V1)'))
put_markdown( put_markdown(
t('如果需要解析个人主页请使用API-V2', 'If you need to parse the personal homepage, please use API-V2')) t('如果需要解析个人主页请使用API-V2', 'If you need to parse the personal homepage, please use API-V2'))
put_markdown(t('API-V2 文档: [https://api-v2.douyin.wtf/docs](https://api-v2.douyin.wtf/docs)', put_markdown(t('API-V2 文档: [https://api.tikhub.io/docs](https://api.tikhub.io/docs)',
'API-V2 Documentation: [https://api-v2.douyin.wtf/docs](https://api-v2.douyin.wtf/docs)')) 'API-V2 Documentation: [https://api.tikhub.io/docs](https://api.tikhub.io/docs)'))
put_markdown(t('该视频已经被删除或屏蔽(你看的都是些啥(⊙_⊙)?)', put_markdown(t('该视频已经被删除或屏蔽(你看的都是些啥(⊙_⊙)?)',
'The video has been deleted or blocked (what are you watching (⊙_⊙)?)')) 'The video has been deleted or blocked (what are you watching (⊙_⊙)?)'))
put_markdown(t('其他原因(请联系作者)', 'Other reasons (please contact the author)')) put_markdown(t('其他原因(请联系作者)', 'Other reasons (please contact the author)'))
@ -92,7 +91,8 @@ def error_do(reason: str, value: str) -> None:
with open('logs.txt', 'a') as f: with open('logs.txt', 'a') as f:
f.write(error_date + ":\n" + str(reason) + '\n' + "Input value: " + value + '\n') f.write(error_date + ":\n" + str(reason) + '\n' + "Input value: " + value + '\n')
else: else:
print(t('输入值中没有douyin或tiktok不记录到日志文件中', 'No douyin or tiktok in the input value, not recorded to the log file')) print(t('输入值中没有douyin或tiktok不记录到日志文件中',
'No douyin or tiktok in the input value, not recorded to the log file'))
# iOS快捷指令弹窗/IOS shortcut pop-up # iOS快捷指令弹窗/IOS shortcut pop-up
@ -137,7 +137,7 @@ def api_document_pop_window():
put_markdown(t("💾API-V2文档", "💾API-V2 Document")) put_markdown(t("💾API-V2文档", "💾API-V2 Document"))
put_markdown(t('API-V2 支持抖音和TikTok的更多接口 如主页解析,视频解析,视频评论解析,个人点赞列表解析等...', put_markdown(t('API-V2 支持抖音和TikTok的更多接口 如主页解析,视频解析,视频评论解析,个人点赞列表解析等...',
'API-V2 supports more interfaces of Douyin and TikTok, such as home page parsing, video parsing, video comment parsing, personal like list parsing, etc...')) 'API-V2 supports more interfaces of Douyin and TikTok, such as home page parsing, video parsing, video comment parsing, personal like list parsing, etc...'))
put_link('[API-V2 Docs]', 'https://api-v2.douyin.wtf/docs', new_window=True) put_link('[API-V2 Docs]', 'https://api.tikhub.io/docs', new_window=True)
put_html('<hr>') put_html('<hr>')
put_markdown(t("💽API-V1文档", "💽API-V1 Document")) put_markdown(t("💽API-V1文档", "💽API-V1 Document"))
put_markdown(t("API-V1 支持抖音和TikTok的单一视频解析具体请查看接口文档。", put_markdown(t("API-V1 支持抖音和TikTok的单一视频解析具体请查看接口文档。",
@ -155,8 +155,8 @@ def log_popup_window():
'Entered the wrong link (the home page link is not supported for parsing with API-V1)')) 'Entered the wrong link (the home page link is not supported for parsing with API-V1)'))
put_markdown( put_markdown(
t('如果需要解析个人主页请使用API-V2', 'If you need to parse the personal homepage, please use API-V2')) t('如果需要解析个人主页请使用API-V2', 'If you need to parse the personal homepage, please use API-V2'))
put_markdown(t('API-V2 文档: [https://api-v2.douyin.wtf/docs](https://api-v2.douyin.wtf/docs)', put_markdown(t('API-V2 文档: [https://api.tikhub.io/docs](https://api.tikhub.io/docs)',
'API-V2 Documentation: [https://api-v2.douyin.wtf/docs](https://api-v2.douyin.wtf/docs)')) 'API-V2 Documentation: [https://api.tikhub.io/docs](https://api.tikhub.io/docs)'))
put_markdown(t('该视频已经被删除或屏蔽(你看的都是些啥(⊙_⊙)?)', put_markdown(t('该视频已经被删除或屏蔽(你看的都是些啥(⊙_⊙)?)',
'The video has been deleted or blocked (what are you watching (⊙_⊙)?)')) 'The video has been deleted or blocked (what are you watching (⊙_⊙)?)'))
put_markdown(t('[点击此处在GitHub上进行反馈](https://github.com/Evil0ctal/Douyin_TikTok_Download_API/issues)', put_markdown(t('[点击此处在GitHub上进行反馈](https://github.com/Evil0ctal/Douyin_TikTok_Download_API/issues)',
@ -194,37 +194,47 @@ def about_popup_window():
put_html('<hr>') put_html('<hr>')
# 网站标题/Website title
web_title = config['Web_APP']['Web_Title']
# 网站描述/Website description
web_description = config['Web_APP']['Web_Description']
# 程序入口/Main interface # 程序入口/Main interface
@pywebio_config(title=web_title, description=web_description, theme='minty') @pywebio_config(theme='minty')
async def main(): async def main():
# 关键字信息 # 关键字信息
keywords = config['Web_APP']['Keywords'] keywords = config['Web_APP']['Keywords']
# 网站描述
description = t(config['Web_APP']['Web_Description'], config['Web_APP']['Web_Description_English'])
# 网站标题/Website title
web_title = t(config['Web_APP']['Web_Title'], config['Web_APP']['Web_Title_English'])
# 设置favicon # 设置favicon
favicon_url = "https://raw.githubusercontent.com/Evil0ctal/Douyin_TikTok_Download_API/main/favicon/android-chrome-512x512.png" favicon_url = "https://raw.githubusercontent.com/Evil0ctal/Douyin_TikTok_Download_API/main/logo/logo192.png"
# 添加<title>标签
session.run_js('document.title = "{}"'.format(web_title))
# 删除初始meta标签包括titledescriptionkeywordsfavicon以免与自定义的meta标签冲突。
session.run_js(""" session.run_js("""
$('head').append('<meta name=referrer content=no-referrer>'); $('head meta[name="keywords"]').remove();
$('#favicon32,#favicon16').remove(); $('head meta[name="description"]').remove();
$('head').append('<link rel="icon" type="image/png" href="%s">') $('head meta[name="title"]').remove();
""" % favicon_url) $('head link[rel="icon"]').remove();
# 设置Keywords """)
session.run_js(""" # 设置favicon,referrer,Keywords,Description,Author,Title
$('head').append('<meta name="keywords" content={}>') session.run_js(f"""
""".format(keywords)) $('head').append('<link rel="icon" type="image/png" href="{favicon_url}">')
$('head').append('<meta name="title" content="{web_title}">')
$('head').append('<meta name=referrer content=no-referrer>');
$('head').append('<meta name="keywords" content="{keywords}">')
$('head').append('<meta name="description" content="{description}">')
$('head').append('<meta name="author" content="Evil0ctal">')
""")
# 修改footer # 修改footer
session.run_js("""$('footer').remove()""") session.run_js("""$('footer').remove()""")
# 网站标题/Website title # 网站标题/Website title
title = t(config['Web_APP']['Web_Title'], config['Web_APP']['Web_Title_English']) title = t(config['Web_APP']['Web_Title'], config['Web_APP']['Web_Title_English'])
put_markdown("""<div align='center' ><font size='20'>😼{}</font></div>""".format(title)) put_html(f"""
put_html('<hr>') <div align="center">
<a href="https://douyin.wtf/" alt="logo" ><img src="{favicon_url}" width="100"/></a>
<h1 align="center">{title}</h1>
</div>
""")
put_row( put_row(
[put_button(t("iOS快捷指令", 'iOS Shortcuts'), onclick=lambda: ios_pop_window(), link_style=True, small=True), [put_button(t("快捷指令", 'Shortcuts'), onclick=lambda: ios_pop_window(), link_style=True, small=True),
put_button("API", onclick=lambda: api_document_pop_window(), link_style=True, small=True), put_button("API", onclick=lambda: api_document_pop_window(), link_style=True, small=True),
put_button(t("日志", "Log"), onclick=lambda: log_popup_window(), link_style=True, small=True), put_button(t("日志", "Log"), onclick=lambda: log_popup_window(), link_style=True, small=True),
put_button(t("关于", 'About'), onclick=lambda: about_popup_window(), link_style=True, small=True) put_button(t("关于", 'About'), onclick=lambda: about_popup_window(), link_style=True, small=True)