mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 04:30:10 +09:00
Merge a4ae6b4520
into c5098961b0
This commit is contained in:
commit
37218111de
0
random.txt
Normal file
0
random.txt
Normal file
BIN
youtube-dl.sig
Normal file
BIN
youtube-dl.sig
Normal file
Binary file not shown.
@ -1,6 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
# from venv import create
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_parse_qs
|
from ..compat import compat_parse_qs
|
||||||
@ -12,6 +13,7 @@ from ..utils import (
|
|||||||
lowercase_escape,
|
lowercase_escape,
|
||||||
try_get,
|
try_get,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
|
unified_strdate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +30,7 @@ class GoogleDriveIE(InfoExtractor):
|
|||||||
)
|
)
|
||||||
(?P<id>[a-zA-Z0-9_-]{28,})
|
(?P<id>[a-zA-Z0-9_-]{28,})
|
||||||
'''
|
'''
|
||||||
|
_API_KEY = "AIzaSyCGrlNJSIw19pjonNQOqMIyS2Xai9g0YT0"
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://drive.google.com/file/d/0ByeS4oOUV-49Zzh4R1J6R09zazQ/edit?pli=1',
|
'url': 'https://drive.google.com/file/d/0ByeS4oOUV-49Zzh4R1J6R09zazQ/edit?pli=1',
|
||||||
'md5': '5c602afbbf2c1db91831f5d82f678554',
|
'md5': '5c602afbbf2c1db91831f5d82f678554',
|
||||||
@ -161,12 +164,25 @@ class GoogleDriveIE(InfoExtractor):
|
|||||||
return self._get_captions_by_type(
|
return self._get_captions_by_type(
|
||||||
video_id, subtitles_id, 'automatic_captions', origin_lang_code)
|
video_id, subtitles_id, 'automatic_captions', origin_lang_code)
|
||||||
|
|
||||||
|
def _call_api(self, video_id):
|
||||||
|
# Call Google Drive API
|
||||||
|
json_data = self._download_json('https://www.googleapis.com/drive/v3/files/%s?fields=createdTime,modifiedTime,owners&key=%s' % (video_id, self._API_KEY), video_id)
|
||||||
|
return json_data
|
||||||
|
|
||||||
|
# USING URL: https://drive.google.com/file/d/1lVFQrzYKnJDd045Gc9xv1W4YA9zKPX7r/view?usp=sharing
|
||||||
|
# API KEY: AIzaSyCGrlNJSIw19pjonNQOqMIyS2Xai9g0YT0
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
video_info = compat_parse_qs(self._download_webpage(
|
video_info = compat_parse_qs(self._download_webpage(
|
||||||
'https://drive.google.com/get_video_info',
|
'https://drive.google.com/get_video_info',
|
||||||
video_id, query={'docid': video_id}))
|
video_id, query={'docid': video_id}))
|
||||||
|
|
||||||
|
json_data = self._call_api(video_id)
|
||||||
|
createdTime = unified_strdate(json_data['createdTime'])
|
||||||
|
modifiedTime = unified_strdate(json_data['modifiedTime'])
|
||||||
|
|
||||||
|
owner_lst = [owner['displayName'] for owner in json_data['owners']]
|
||||||
|
|
||||||
def get_value(key):
|
def get_value(key):
|
||||||
return try_get(video_info, lambda x: x[key][0])
|
return try_get(video_info, lambda x: x[key][0])
|
||||||
|
|
||||||
@ -271,6 +287,9 @@ class GoogleDriveIE(InfoExtractor):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'thumbnail': 'https://drive.google.com/thumbnail?id=' + video_id,
|
'thumbnail': 'https://drive.google.com/thumbnail?id=' + video_id,
|
||||||
'duration': int_or_none(get_value('length_seconds')),
|
'duration': int_or_none(get_value('length_seconds')),
|
||||||
|
'created_date': createdTime,
|
||||||
|
'modified_date': modifiedTime,
|
||||||
|
'owners': owner_lst,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': self.extract_subtitles(video_id, subtitles_id, hl),
|
'subtitles': self.extract_subtitles(video_id, subtitles_id, hl),
|
||||||
'automatic_captions': self.extract_automatic_captions(
|
'automatic_captions': self.extract_automatic_captions(
|
||||||
|
Loading…
Reference in New Issue
Block a user