mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 03:37:52 +03:00
✨ add douyin support
This commit is contained in:
parent
3032ec9679
commit
4ce28ac2b5
@ -414,6 +414,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the
|
|||||||
| 全民直播 | <http://www.quanmin.tv/> |✓| | |
|
| 全民直播 | <http://www.quanmin.tv/> |✓| | |
|
||||||
| 阳光宽频网 | <http://www.365yg.com/> |✓| | |
|
| 阳光宽频网 | <http://www.365yg.com/> |✓| | |
|
||||||
| 西瓜视频 | <https://www.ixigua.com/> |✓| | |
|
| 西瓜视频 | <https://www.ixigua.com/> |✓| | |
|
||||||
|
| 抖音 | <https://www.douyin.com/> |✓| | |
|
||||||
|
|
||||||
For all other sites not on the list, the universal extractor will take care of finding and downloading interesting resources from the page.
|
For all other sites not on the list, the universal extractor will take care of finding and downloading interesting resources from the page.
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ SITES = {
|
|||||||
'dailymotion' : 'dailymotion',
|
'dailymotion' : 'dailymotion',
|
||||||
'dilidili' : 'dilidili',
|
'dilidili' : 'dilidili',
|
||||||
'douban' : 'douban',
|
'douban' : 'douban',
|
||||||
|
'douyin' : 'douyin',
|
||||||
'douyu' : 'douyutv',
|
'douyu' : 'douyutv',
|
||||||
'ehow' : 'ehow',
|
'ehow' : 'ehow',
|
||||||
'facebook' : 'facebook',
|
'facebook' : 'facebook',
|
||||||
|
@ -15,6 +15,7 @@ from .coub import *
|
|||||||
from .dailymotion import *
|
from .dailymotion import *
|
||||||
from .dilidili import *
|
from .dilidili import *
|
||||||
from .douban import *
|
from .douban import *
|
||||||
|
from .douyin import *
|
||||||
from .douyutv import *
|
from .douyutv import *
|
||||||
from .ehow import *
|
from .ehow import *
|
||||||
from .facebook import *
|
from .facebook import *
|
||||||
|
38
src/you_get/extractors/douyin.py
Normal file
38
src/you_get/extractors/douyin.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from ..common import (
|
||||||
|
url_size,
|
||||||
|
print_info,
|
||||||
|
get_content,
|
||||||
|
download_urls,
|
||||||
|
playlist_not_supported,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['douyin_download_by_url']
|
||||||
|
|
||||||
|
|
||||||
|
def douyin_download_by_url(url, **kwargs):
|
||||||
|
page_content = get_content(url)
|
||||||
|
match_rule = re.compile(r'var data = \[(.*?)\];')
|
||||||
|
video_info = json.loads(match_rule.findall(page_content)[0])
|
||||||
|
video_url = video_info['video']['play_addr']['url_list'][0]
|
||||||
|
title = video_info['cha_list'][0]['cha_name']
|
||||||
|
video_format = 'mp4'
|
||||||
|
size = url_size(video_url)
|
||||||
|
print_info(
|
||||||
|
site_info='douyin.com', title=title,
|
||||||
|
type=video_format, size=size
|
||||||
|
)
|
||||||
|
if not kwargs['info_only']:
|
||||||
|
download_urls(
|
||||||
|
urls=[video_url], title=title, ext=video_format, total_size=size,
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
download = douyin_download_by_url
|
||||||
|
download_playlist = playlist_not_supported('douyin')
|
@ -8,6 +8,7 @@ from you_get.extractors import (
|
|||||||
youtube,
|
youtube,
|
||||||
yixia,
|
yixia,
|
||||||
bilibili,
|
bilibili,
|
||||||
|
douyin,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -46,6 +47,12 @@ class YouGetTests(unittest.TestCase):
|
|||||||
'https://www.bilibili.com/video/av13228063/', info_only=True
|
'https://www.bilibili.com/video/av13228063/', info_only=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_douyin(self):
|
||||||
|
douyin.download(
|
||||||
|
'https://www.douyin.com/share/video/6492273288897629454',
|
||||||
|
info_only=True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user