modifiedtime and owner metadata

This commit is contained in:
cryhwang 2022-12-11 13:24:00 -05:00
parent 9b8ed4477c
commit 237e55ef91
3 changed files with 46 additions and 3 deletions

BIN
youtube-dl.sig Normal file

Binary file not shown.

View file

@ -0,0 +1,38 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class FreeTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?yourextractor\.com/watch/(?P<id>[0-9]+)'
_TEST = {
'url': 'https://yourextractor.com/watch/42',
'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
'info_dict': {
'id': '42',
'ext': 'mp4',
'title': 'Video title goes here',
'thumbnail': r're:^https?://.*\.jpg$',
# TODO more properties, either as:
# * A value
# * MD5 checksum; start the string with md5:
# * A regular expression; start the string with re:
# * Any Python type (for example int or float)
}
}
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
# TODO more code goes here, for example ...
title = self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title')
return {
'id': video_id,
'title': title,
'description': self._og_search_description(webpage),
'uploader': self._search_regex(r'<div[^>]+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False),
# TODO more properties (see youtube_dl/extractor/common.py)
}

View file

@ -13,6 +13,7 @@ from ..utils import (
lowercase_escape,
try_get,
update_url_query,
unified_strdate,
)
class GoogleDriveIE(InfoExtractor):
@ -164,7 +165,7 @@ class GoogleDriveIE(InfoExtractor):
def _call_api(self, video_id):
# Call Google Drive API
# 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)
print("_real_extract json_data: ", json_data)
return json_data
@ -178,11 +179,15 @@ class GoogleDriveIE(InfoExtractor):
video_info = compat_parse_qs(self._download_webpage(
'https://drive.google.com/get_video_info',
video_id, query={'docid': video_id}))
# print("_real_extract video_info: ", video_info)
json_data = self._call_api(video_id)
createdTime = json_data['createdTime']
modifiedTime = json_data['modifiedTime']
print("createdTime: ", createdTime)
owner_lst = []
for owner in json_data['owners']:
owner_lst.append(owner['displayName'])
def get_value(key):
return try_get(video_info, lambda x: x[key][0])