Giter Club home page Giter Club logo

douyin_downloader's Introduction

⚠️️务必阅读

最近查看网页版本发现项目所使用的部分接口参数有所修改,因此项目可能已经无法使用,保留仅供参考学习使用。目前本人暂时没有时间更新,欢迎有兴趣且有能力的人修改提交你的方案,谢谢!

抖音寻找漂亮小姐姐or帅气小哥哥,并下载她(他)们的所有作品

⚠️ 因为依赖关系,只支持Python3.6且仅在此版本上进行过测试,其他版本无法保证相同效果,欢迎提交PR支持。

原本只是写了一个下载抖音无水印视频的小脚本,后面突然想到了Douyin-Bot这个项目,觉得是可以结合操作的,达到完全自动化,所以就引入了相关的代码,并进行了一定的逻辑修改,实现了目前的流程。

Python + ADB实现抖音的控制浏览 -> 复制视频链接 -> 提取用户信息 -> 程序下载用户所有视频

⏰ 如果你只需要下载功能,可以直接查看 DOWNLOAD.md,无需查看后续内容

环境安装

请在使用项目之前确保你的手机可以正常使用adb控制,相关信息可以网上搜索。另外复制内容需要使用clipper.apk,在apks中有提供,项目地址,可自行查看,另外 请允许此app后台运行,自测发现未后台运行会导致获取不到剪贴板内容

$ git clone [email protected]:renyijiu/douyin_downloader.git
$ cd douyin_downloader
$ virtualenv -p python3.6 douyin
$ source douyin/bin/activate
$ pip install -r requirements.txt

使用

  1. 打开抖音app
  2. 执行 python douyin-bot.py

⚠注意️

  1. 具体Python + ADB实现抖音的控制浏览,可以查看Douyin-Bot去了解,这里不做介绍了
  2. 目前ADB获取剪贴板操作,通过 clipper.apk实现,如果你有更好的方案,欢迎提出更改,感谢🙏!
  3. 目前提供的配置是基于自己的 魅族pro5 测试机,不同机型请自行修改(欢迎提供你的配置)
  • config.json配置文件参考:
    • center_point: 屏幕中心点(x, y),区域范围(rx, ry),主要翻页使用
    • left_swipe_point: 起始点坐标(x, y),区域范围(rx, ry),分享按钮时活动获取复制链接使用
    • follow_bottom: 关注按钮坐标(x, y), 区域范围(rx, ry)
    • star_bottom: 点赞按钮坐标(x, y),区域范围(rx, ry)
    • share_bootom: 分享按钮坐标(x, y),区域范围(rx, ry)
    • copy_link_bottom: 复制链接按钮(分享按钮点击后弹出)(x, y),区域范围(rx, ry)
    • crop_img: 截图范围起始点坐标(x, y),区域范围(width, height), 从页面截图裁剪部分(为了去除头像之类的干扰信息),另外范围过大可能导致图像过大使接口报错,请自行增加压缩操作

感谢

站在巨人的肩膀

  1. Douyin-Bot
  2. clipper

建议反馈

请直接在Github上开新的issue,描述清楚你的问题需求即可。

CHANGELOG

changelog

赞赏

douyin_downloader's People

Contributors

dependabot[bot] avatar renyijiu avatar tianqiyuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

douyin_downloader's Issues

下载出错了

Traceback (most recent call last):
File "douyin.py", line 539, in
CrawlerScheduler(content, favorite)
File "douyin.py", line 341, in init
self.scheduling(favorite)
File "douyin.py", line 350, in scheduling
self.download_user_videos(user_id, favorite)
File "douyin.py", line 368, in download_user_videos
self.push_download_job(uid, dytk, 0, favorite)
File "douyin.py", line 379, in push_download_job
list_json = get_list_by_uid(user_id, dytk, cursor, favorite)
File "douyin.py", line 95, in get_list_by_uid
signature = FREEZE_SIGNATURE if FREEZE_SIGNATURE else get_signature(user_id)
File "douyin.py", line 70, in get_signature
r.html.render()
File "D:\Python\Python36\lib\site-packages\requests_html.py", line 654, in html
self._html = HTML(session=self.session, url=self.url, html=self.content, default_encoding=self.encoding)
File "D:\Python\Python36\lib\site-packages\requests_html.py", line 421, in init
element=PyQuery(html)('html') or PyQuery(f'{html}')('html'),
File "D:\Python\Python36\lib\site-packages\pyquery\pyquery.py", line 266, in init
raise TypeError(context)
TypeError: None
他提到的requests_html和pyquery我重新卸载安装过,问题依旧,是哪出问题了?

TypeError: 'NoneType' object is not subscriptable

Traceback (most recent call last):
File "douyin.py", line 574, in
CrawlerScheduler(content, favorite)
File "douyin.py", line 370, in init
self.scheduling(favorite)
File "douyin.py", line 379, in scheduling
self.download_user_videos(user_id, favorite)
File "douyin.py", line 396, in download_user_videos
uid, dytk = get_user_info(user_id)
File "douyin.py", line 78, in get_user_info
uid = r.html.search('uid: "{uid}"')['uid']
TypeError: 'NoneType' object is not subscriptable

ssl problem

When I use the scripts python douyin.py --url=https://v.douyin.com/JRoydED/, I jsut encountered the problem following
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='storage.googleapis.com', port=443): Max retries exceeded with url: /chromium-browser-snapshots/Mac/575458/chrome-mac.zip (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))). I don't know how to solve it.

去水印怎么做的

通过分享链接,如何能做到去水印呢?我看渲染出来的video标签内的链接并没有水印的参数,是在那步修改的url呢?

我得到这个错误。 请帮帮我

Traceback (most recent call last):
File "douyin.py", line 11, in
from requests_html import HTMLSession
File "C:\Python\lib\site-packages\requests_html.py", line 9, in
import pyppeteer
File "C:\Python\lib\site-packages\pyppeteer_init_.py", line 30, in
from pyppeteer.launcher import connect, launch, executablePath # noqa: E402
File "C:\Python\lib\site-packages\pyppeteer\launcher.py", line 24, in
from pyppeteer.browser import Browser
File "C:\Python\lib\site-packages\pyppeteer\browser.py", line 13, in
from pyppeteer.connection import Connection
File "C:\Python\lib\site-packages\pyppeteer\connection.py", line 12, in
import websockets
File "C:\Python\lib\site-packages\websockets_init_.py", line 3, in
from .auth import *
File "C:\Python\lib\site-packages\websockets\auth.py", line 15, in
from .server import HTTPResponse, WebSocketServerProtocol
File "C:\Python\lib\site-packages\websockets\server.py", line 49, in
from .protocol import WebSocketCommonProtocol
File "C:\Python\lib\site-packages\websockets\protocol.py", line 18, in
from typing import (
ImportError: cannot import name 'Deque'

无法一次下载一个账号的所有视频

  1. python douyin.py --urls="http://v.douyin.com/moUEXM/"
  2. terminal中打印出

(douyin_env) F:\工作 2\一>python douyin.py --urls="http://v.douyin.com/moUEXM/"
Traceback (most recent call last):
File "douyin.py", line 539, in
CrawlerScheduler(content, favorite)
File "douyin.py", line 341, in init
self.scheduling(favorite)
File "douyin.py", line 350, in scheduling
self.download_user_videos(user_id, favorite)
File "douyin.py", line 368, in download_user_videos
self.push_download_job(uid, dytk, 0, favorite)
File "douyin.py", line 379, in push_download_job
list_json = get_list_by_uid(user_id, dytk, cursor, favorite)
File "douyin.py", line 95, in get_list_by_uid
signature = FREEZE_SIGNATURE if FREEZE_SIGNATURE else get_signature(user_id)
File "douyin.py", line 70, in get_signature
r.html.render()
File "F:\工作 2\一\douyin_env\lib\site-packages\requests_html.py", line 654, in html
self._html = HTML(session=self.session, url=self.url, html=self.content, default_encoding=self.encoding)
File "F:\工作 2\一\douyin_env\lib\site-packages\requests_html.py", line 421, in init
element=PyQuery(html)('html') or PyQuery(f'{html}')('html'),
File "F:\工作 2一\douyin_env\lib\site-packages\pyquery\pyquery.py", line 266, in init
raise TypeError(context)
TypeError: None

  1. python douyin.py -s -u 分享短链接/长链接 可以下载单个视频的

Cannot get list video

I only got response: get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}

无法获取视频,报错如下

get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
get empty list, {'has_more': 0, 'status_code': 0, 'aweme_list': []}
retry...
Traceback (most recent call last):
File "douyin.py", line 539, in
CrawlerScheduler(content, favorite)
File "douyin.py", line 341, in init
self.scheduling(favorite)
File "douyin.py", line 350, in scheduling
self.download_user_videos(user_id, favorite)
File "douyin.py", line 368, in download_user_videos
self.push_download_job(uid, dytk, 0, favorite)
File "douyin.py", line 379, in push_download_job
list_json = get_list_by_uid(user_id, dytk, cursor, favorite)
File "douyin.py", line 116, in get_list_by_uid
res_json = json.loads(r.html.text)
File "/usr/lib64/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.