asp.net實(shí)用網(wǎng)站開發(fā)沈陽網(wǎng)絡(luò)關(guān)鍵詞排名
當(dāng)下正值短視頻盛行的時(shí)代。在我們?yōu)g覽短視頻的同時(shí),經(jīng)常能發(fā)現(xiàn)一些精美的圖片、引人入勝的文案以及吸引眼球的視頻,想要將它們保存到本地。然而,保存下來的圖片或視頻通常伴隨著不太愉悅的水印,這顯著降低了使用體驗(yàn)。因此,我時(shí)常思考是否存在途徑能夠下載一些無水印的圖片。雖然有許多小程序等可以保存無水印的圖片或視頻,但它們往往伴隨著一些令人不悅的廣告或付費(fèi)等。今天,在瀏覽 GitHub 時(shí)偶然發(fā)現(xiàn)了一個(gè)開源項(xiàng)目,名為“Douyin_TikTok_Download_API”,它能夠滿足我們的需求。在本文中,我將詳細(xì)介紹這個(gè)項(xiàng)目,并分享如何進(jìn)行部署和使用。
項(xiàng)目簡介
github地址: https://github.com/Evil0ctal/Douyin_TikTok_Download_API
目前該項(xiàng)目在github 已有5.1k star,如下是作者寫的項(xiàng)目介紹:
「Douyin_TikTok_Download_API」是一個(gè)開箱即用的高性能異步抖音|TikTok|Bilibili數(shù)據(jù)爬取工具,支持API調(diào)用,在線批量解析及下載。
該項(xiàng)目是基于 PyWebIO,FastAPI,AIOHTTP,快速異步的抖音/TikTok/Bilibili數(shù)據(jù)爬取工具,并通過Web端實(shí)現(xiàn)在線批量解析以及下載無水印視頻或圖集,數(shù)據(jù)爬取API,iOS快捷指令無水印下載等功能。你可以自己部署或改造本項(xiàng)目實(shí)現(xiàn)更多功能,也可以在你的項(xiàng)目中直接調(diào)用scraper.py或安裝現(xiàn)有的pip包作為解析庫輕松爬取數(shù)據(jù)等…
一些簡單的運(yùn)用場景:
下載禁止下載的視頻,進(jìn)行數(shù)據(jù)分析,iOS無水印下載(搭配iOS自帶的快捷指令A(yù)PP 配合本項(xiàng)目API實(shí)現(xiàn)應(yīng)用內(nèi)下載或讀取剪貼板下載)等…
項(xiàng)目部署
在 README 中,作者提供了兩種部署方式。我們選擇了基于 Docker 的部署方法,接下來將詳細(xì)介紹如何使用 docker-compose 進(jìn)行部署。
第一步:創(chuàng)建docker-compose.yml 文件
我們在服務(wù)器上創(chuàng)建一個(gè)部署目錄tiktok
,在tiktok
下創(chuàng)建docker-compose.yml文件,內(nèi)容如下:
docker-compose.yml
version: "3.7"
services:# botdouyin_tiktok_download_api:image: evil0ctal/douyin_tiktok_download_apinetwork_mode: hostcontainer_name: douyin_tiktok_download_apirestart: alwaysvolumes:- ./config.ini:/app/config.inienvironment:TZ: Asia/Shanghaideploy:resources:limits:cpus: '0.80'
第二步:創(chuàng)建config.ini 文件
項(xiàng)目的相關(guān)配置存儲在 config.ini 文件中,因此當(dāng)需要進(jìn)行配置更改時(shí),只需編輯 config.ini 文件即可。
在與 docker-compose.yml 同級的目錄下創(chuàng)建 config.ini 文件,然后將項(xiàng)目中 config.ini 文件的內(nèi)容復(fù)制到新創(chuàng)建的 config.ini 文件中。
# -*- encoding: utf-8 -*-
# @Author: https://github.com/Evil0ctal/
# @Time: 2021/11/06
# @Update: 2022/11/09
# @Function:
# 項(xiàng)目的配置文件/Config file of the project[Scraper] # scraper.py
# 是否使用代理(如果部署在IP受限國家需要開啟默認(rèn)為False關(guān)閉,請自行收集代理,下面代理僅作為示例不保證可用性)
# Whether to use proxy (if deployed in a country with IP restrictions, it needs to be turned on by default, False is closed. Please collect proxies yourself. The following proxies are only for reference and do not guarantee availability)
Proxy_switch = False# 是否根據(jù)不同協(xié)議(http/https)使用不同代理,設(shè)置為True時(shí)修改Http_proxy/Https_proxy這兩個(gè)變量的值
# Whether to use different proxies for different protocols (http/https). When set to True, modify the values of the two variables Http_proxy/Https_proxy
Use_different_protocols = False# http/https協(xié)議都使用以下代理(Use_different_protocols為False時(shí)生效)
# Both http/https protocols use the following proxy (effective when Use_different_protocols is False)
All = 45.167.124.5:9992# http協(xié)議使用以下代理(Use_different_protocols為True時(shí)生效)
# The http protocol uses the following proxy (effective when Use_different_protocols is True)
Http_proxy = http://45.167.124.5:9992# https協(xié)議使用以下代理(Use_different_protocols為True時(shí)生效)
# The https protocol uses the following proxy (effective when Use_different_protocols is True)
Https_proxy = https://45.167.124.5:9992# 抖音cookies配置項(xiàng)
# odin_tt=xxx;sessionid_ss=xxx;ttwid=xxx;passport_csrf_token=xxx;msToken=xxx;
DouYinCookies =[Web_API] # web_api.py
# API鏈接 如:http://127.0.0.1:2333 或 http://api.douyin.wtf (末尾不要留斜杠)
# API link, such as: http://127.0.0.1:2333 or http://api.douyin.wtf (no slash at the end)
Domain = http://api.douyin.wtf# 限制API的請求次數(shù)/Limited API requests
Rate_Limit = 10/minute# API默認(rèn)運(yùn)行端口/Default port of API
Port = 8000# 默認(rèn)下載目錄/Default download directory
Download_Path = ./download# 是否開啟下載[tag = Download]功能(默認(rèn)開啟,關(guān)閉后無法下載)/Whether to enable the download [tag = Download] function (default open, closed after download)
Download_Switch = True# 是否自動(dòng)清理下載目錄/Whether to automatically clean up the download directory
Download_Path_Clean_Switch = True# 下載文件夾自動(dòng)刪除時(shí)間(單位:秒)/Download folder automatic deletion time (unit: seconds)
Download_Path_Clean_Timer = 3600# 默認(rèn)下載文件名前綴/Default download file name prefix
File_Name_Prefix = api.douyin.wtf_# 是否記錄API調(diào)用日志/Whether to record API call logs
Allow_Logs = True# 快捷指令版本/Shortcut version
iOS_Shortcut_Version = 6.0# 快捷指令Link(Chinese_Language)
iOS_Shortcut_Link = https://www.icloud.com/shortcuts/4465d514869e4ca585074d40328f3e0e# Shortcut Link(English_Language)
iOS_Shortcut_Link_EN = https://www.icloud.com/shortcuts/58e3a2cbac784a6782f1031c6b1dd9f8# 快捷指令更新時(shí)間/Shortcut update time
iOS_Shortcut_Update_Time = 2022/11/06# 快捷指令更新記錄/Shortcut update log
iOS_Shortcut_Update_Note = 重新適配https://api.douyin.wtf(API-V1 3.0.0版本)# iOS shortcut update note
iOS_Shortcut_Update_Note_EN = Re-adapt https://api.douyin.wtf (API-V1 3.0.0 version)[Web_APP] # web_app.py
# 網(wǎng)頁默認(rèn)運(yùn)行端口/Web default running port
Port = 80# PyWebIO是否使用CDN來獲取前端的靜態(tài)資源(防止CDN被墻導(dǎo)致無法正常顯示)
# Whether PyWebIO uses CDN to obtain static resources of the front end (to prevent CDN from being blocked and displayed normally)
PyWebIO_CDN = True# 最大接受提交URL的數(shù)量/Maximum number of URLs accepted for submission
Max_Take_URLs = 200# 是否記錄錯(cuò)誤日志/Whether to record error logs
Allow_Logs = True# 網(wǎng)頁標(biāo)題
Web_Title = TikTok/抖音無水印在線解析下載# Web Title English
Web_Title_English = Douyin/TikTok online parsing and download without watermark# 網(wǎng)頁描述
Web_Description = 在線批量解析TikTok/抖音視頻和圖片,支持無水印下載,官方數(shù)據(jù)接口,穩(wěn)定,開源,免費(fèi),無廣告。# Web Description English
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.# 網(wǎng)頁關(guān)鍵詞/Keywords of the web page
Keywords = 抖音,tiktok,水印,無水印,no-watermark,抖音去水印,tiktok no watermark,在線,online,api,快捷指令,shortcut,下載,解析,parsing,tiktok api,抖音api,抖音去水印在線,tiktok去水印在線,downloader,下載器,free api,免費(fèi)api
我門需要修改的地方:
- DouYinCookies =
這一步需要從我們的抖音網(wǎng)頁版獲取信息,具體的獲取方法如下:
1.打開抖音網(wǎng)頁版,如果已經(jīng)登錄,請退出登錄。接著,按下 F12 鍵打開開發(fā)者工具,點(diǎn)擊 Network。
2.點(diǎn)擊頁面上的登錄,然后通過掃碼的方式完成抖音登錄。登錄成功后,我們可以看到Network如下的接口信息。
3.復(fù)制請求頭中的 Cookie 值,將其粘貼到 config.ini 文件中的 DouYinCookies 字段中。
如果在后期使用的時(shí)候Cookie過期了的話重新按此方法獲取新的Cookie,重啟服務(wù)即可。
- Domain = http://api.douyin.wtf
修改這個(gè)地址為 我們部署的機(jī)器ip和api的port,末尾不要留斜杠
比如我們的地址是: Domain = http://192.168.10.106:8000
api的端口默認(rèn)為8000,Web_APP的端口默認(rèn)為80,如果本地端口有沖突的話可以自定義修改,修改之后在Domain = http://192.168.10.106:8000 保持一致就可以。
第三步:啟動(dòng)容器
在docker-compose.yml統(tǒng)計(jì)目錄下執(zhí)行如下命令啟動(dòng)容器:
docker-compose up -d
查看容器啟動(dòng)日志
docker-compose logs -f
如果不出意外的話我們服務(wù)就已經(jīng)啟動(dòng)了。
第四步:訪問服務(wù)
我們在瀏覽器中訪問ip:Web_APP的port,我們此處是內(nèi)網(wǎng)部署,地址為 http://192.168.10.106:8019/
我們?nèi)绻诙兑糁邪l(fā)現(xiàn)一些精美的圖片,我們只需要復(fù)制鏈接到頁面提交即可。
如果我們需要的圖片少的話右擊另存為保存即可,比較多的話點(diǎn)擊打包下載即可下載到本地。視頻也是同樣的操作,我們此處就就不做演示了。
免責(zé)聲明
本文章僅限用于學(xué)習(xí)和研究目的;不得將上述內(nèi)容用于商業(yè)或者非法用途,否則,一切后果請讀者自負(fù)。
使用者對本文章內(nèi)容的使用由使用者自行決定,并自行承擔(dān)風(fēng)險(xiǎn)。博主對使用者使用本文章內(nèi)容所產(chǎn)生的任何損失、責(zé)任、或風(fēng)險(xiǎn)概不負(fù)責(zé)。
每日閑談
今天是2024年上班的第一天,短暫地回顧了一下2023年的經(jīng)歷,發(fā)現(xiàn)當(dāng)初設(shè)定的很多目標(biāo)未能如愿實(shí)現(xiàn),執(zhí)行過程中存在很多拖延的情況,這讓我對自己的執(zhí)行力感到不夠滿意。希望從現(xiàn)在開始,能夠提升自己的執(zhí)行力。
刷短視頻的時(shí)候,正好看到了諸葛亮的《戒子篇》?!胺菍W(xué)無以廣才,非志無以成學(xué)”——沒有學(xué)習(xí)就難以拓寬才華,沒有志向就難以實(shí)現(xiàn)學(xué)識。年歲匆匆,心意如流水般逝去,這讓我頗為感慨。再次分享這篇文章,期望與大家共勉。在新的一年里,讓我們共同努力,提升執(zhí)行力,堅(jiān)定目標(biāo),創(chuàng)造更加輝煌的未來。