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/> |✓| | |
|
||||
| **Twitter** | <https://twitter.com/> |✓|✓| |
|
||||
| VK | <http://vk.com/> |✓| | |
|
||||
| VK | <http://vk.com/> |✓|✓| |
|
||||
| Vine | <https://vine.co/> |✓| | |
|
||||
| Vimeo | <https://vimeo.com/> |✓| | |
|
||||
| Vidto | <http://vidto.me/> |✓| | |
|
||||
|
@ -7,12 +7,14 @@ from ..common import *
|
||||
|
||||
def get_video_info(url):
|
||||
video_page = get_content(url)
|
||||
title = unescape_html(r1(r'"title":"([^"]+)"', video_page))
|
||||
info = dict(re.findall(r'\\"url(\d+)\\":\\"([^"]+)\\"', video_page))
|
||||
title = r1(r'<div class="vv_summary">(.[^>]+?)</div', video_page)
|
||||
sources = re.findall(r'<source src=\"(.[^>]+?)"', video_page)
|
||||
|
||||
for quality in ['1080', '720', '480', '360', '240']:
|
||||
if quality in info:
|
||||
url = re.sub(r'\\\\\\/', r'/', info[quality])
|
||||
break
|
||||
for source in sources:
|
||||
if source.find(quality) != -1:
|
||||
url = source
|
||||
break
|
||||
assert url
|
||||
type, ext, size = url_info(url)
|
||||
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):
|
||||
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)
|
||||
elif re.match(r'(.+)vk\.com\/photo(.+)', url):
|
||||
link, title, ext, size = get_image_info(url)
|
||||
|
Loading…
Reference in New Issue
Block a user