mirror of
https://github.com/soimort/you-get.git
synced 2025-02-02 16:24:00 +03:00
Lets fix vk videos
This commit is contained in:
parent
13b63aa773
commit
50c911507b
@ -318,7 +318,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the
|
|||||||
| :--: | :-- | :-----: | :-----: | :-----: |
|
| :--: | :-- | :-----: | :-----: | :-----: |
|
||||||
| **YouTube** | <https://www.youtube.com/> |✓| | |
|
| **YouTube** | <https://www.youtube.com/> |✓| | |
|
||||||
| **Twitter** | <https://twitter.com/> |✓|✓| |
|
| **Twitter** | <https://twitter.com/> |✓|✓| |
|
||||||
| VK | <http://vk.com/> |✓| | |
|
| VK | <http://vk.com/> |✓|✓| |
|
||||||
| Vine | <https://vine.co/> |✓| | |
|
| Vine | <https://vine.co/> |✓| | |
|
||||||
| Vimeo | <https://vimeo.com/> |✓| | |
|
| Vimeo | <https://vimeo.com/> |✓| | |
|
||||||
| Vidto | <http://vidto.me/> |✓| | |
|
| Vidto | <http://vidto.me/> |✓| | |
|
||||||
|
@ -7,12 +7,14 @@ from ..common import *
|
|||||||
|
|
||||||
def get_video_info(url):
|
def get_video_info(url):
|
||||||
video_page = get_content(url)
|
video_page = get_content(url)
|
||||||
title = unescape_html(r1(r'"title":"([^"]+)"', video_page))
|
title = r1(r'<div class="vv_summary">(.[^>]+?)</div', video_page)
|
||||||
info = dict(re.findall(r'\\"url(\d+)\\":\\"([^"]+)\\"', video_page))
|
sources = re.findall(r'<source src=\"(.[^>]+?)"', video_page)
|
||||||
|
|
||||||
for quality in ['1080', '720', '480', '360', '240']:
|
for quality in ['1080', '720', '480', '360', '240']:
|
||||||
if quality in info:
|
for source in sources:
|
||||||
url = re.sub(r'\\\\\\/', r'/', info[quality])
|
if source.find(quality) != -1:
|
||||||
break
|
url = source
|
||||||
|
break
|
||||||
assert url
|
assert url
|
||||||
type, ext, size = url_info(url)
|
type, ext, size = url_info(url)
|
||||||
print_info(site_info, title, type, size)
|
print_info(site_info, title, type, size)
|
||||||
@ -37,7 +39,7 @@ def get_image_info(url):
|
|||||||
|
|
||||||
def vk_download(url, output_dir='.', stream_type=None, merge=True, info_only=False, **kwargs):
|
def vk_download(url, output_dir='.', stream_type=None, merge=True, info_only=False, **kwargs):
|
||||||
link = None
|
link = None
|
||||||
if re.match(r'vk.com/photo', url):
|
if re.match(r'(.+)z\=video(.+)', url):
|
||||||
link, title, ext, size = get_video_info(url)
|
link, title, ext, size = get_video_info(url)
|
||||||
elif re.match(r'(.+)vk\.com\/photo(.+)', url):
|
elif re.match(r'(.+)vk\.com\/photo(.+)', url):
|
||||||
link, title, ext, size = get_image_info(url)
|
link, title, ext, size = get_image_info(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user