From cddc1cb9b8f0883890d39decc0343fd42e4dc2e1 Mon Sep 17 00:00:00 2001 From: Philip Xu Date: Mon, 12 Jul 2021 05:08:56 -0400 Subject: [PATCH] [douyin] Add new extractor --- youtube_dl/extractor/douyin.py | 78 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 79 insertions(+) create mode 100644 youtube_dl/extractor/douyin.py diff --git a/youtube_dl/extractor/douyin.py b/youtube_dl/extractor/douyin.py new file mode 100644 index 000000000..0454a9dce --- /dev/null +++ b/youtube_dl/extractor/douyin.py @@ -0,0 +1,78 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import json + +from .common import ( + InfoExtractor, + compat_urllib_parse_unquote, +) + + +class DouyinIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?douyin\.com/video/(?P[0-9]+)' + _TESTS = [{ + 'url': 'https://www.douyin.com/video/6961737553342991651', + 'md5': 'f0114e6688442972d80fab1083543197', + 'info_dict': { + 'id': '6961737553342991651', + 'ext': 'mp4', + 'title': '#杨超越 小小水手带你去远航❤️', + } + }, { + 'url': 'https://www.douyin.com/video/6982497745948921092', + 'md5': 'bdc8a6b4ce22c887e0064d2813befa27', + 'info_dict': { + 'id': '6982497745948921092', + 'ext': 'mp4', + 'title': '这个夏日和小羊@杨超越 一起遇见白色幻想', + } + }, { + 'url': 'https://www.douyin.com/video/6953975910773099811', + 'md5': 'dde3302460f19db59c47060ff013b902', + 'info_dict': { + 'id': '6953975910773099811', + 'ext': 'mp4', + 'title': '#一起看海 出现在你的夏日里', + } + }, { + 'url': 'https://www.douyin.com/video/6950251282489675042', + 'md5': 'f61844399e85f0ff18cfab91d20fe326', + 'info_dict': { + 'id': '6950251282489675042', + 'ext': 'mp4', + 'title': '哈哈哈,成功了哈哈哈哈哈哈', + } + }, { + 'url': 'https://www.douyin.com/video/6963263655114722595', + 'md5': '30a852b6efb232df202b80894f51422d', + 'info_dict': { + 'id': '6963263655114722595', + 'ext': 'mp4', + 'title': '#哪个爱豆的105度最甜 换个角度看看我哈哈', + } + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + # The video player and video source are rendered client-side, the data + # contains in a