Skip to content

Commit

Permalink
Merge branch 'bilibibi-embed' of https://github.com/zmwangx/you-get i…
Browse files Browse the repository at this point in the history
…nto zmwangx-bilibibi-embed
  • Loading branch information
soimort committed Dec 24, 2016
2 parents f48aad9 + a6d3c13 commit 932c707
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/you_get/extractors/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from ..common import *

from .bilibili import bilibili_download
from .iqiyi import iqiyi_download_by_vid
from .le import letvcloud_download_by_vu
from .netease import netease_download
Expand Down Expand Up @@ -42,6 +43,11 @@

vimeo_embed_patters = [ 'player\.vimeo\.com/video/(\d+)' ]

"""
check the share button on http://www.bilibili.com/video/av5079467/
"""
bilibili_embed_patterns = [ 'static\.hdslb\.com/miniloader\.swf.*aid=(\d+)' ]


def embed_download(url, output_dir = '.', merge = True, info_only = False ,**kwargs):
content = get_content(url, headers=fake_headers)
Expand Down Expand Up @@ -78,6 +84,12 @@ def embed_download(url, output_dir = '.', merge = True, info_only = False ,**kwa
found = True
vimeo_download_by_id(url, title=title, output_dir=output_dir, merge=merge, info_only=info_only)

aids = matchall(content, bilibili_embed_patterns)
for aid in aids:
found = True
url = 'http://www.bilibili.com/video/av%s/' % aid
bilibili_download(url, output_dir=output_dir, merge=merge, info_only=info_only)

if not found:
raise NotImplementedError(url)

Expand Down

0 comments on commit 932c707

Please sign in to comment.