From 237e55ef91d19d377da81d6fb82cbc9528f539ad Mon Sep 17 00:00:00 2001 From: cryhwang Date: Sun, 11 Dec 2022 13:24:00 -0500 Subject: [PATCH] modifiedtime and owner metadata --- youtube-dl.sig | Bin 0 -> 566 bytes youtube_dl/extractor/freetv.py | 38 ++++++++++++++++++++++++++++ youtube_dl/extractor/googledrive.py | 11 +++++--- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 youtube-dl.sig create mode 100644 youtube_dl/extractor/freetv.py diff --git a/youtube-dl.sig b/youtube-dl.sig new file mode 100644 index 0000000000000000000000000000000000000000..d866f04dd97fd7f30128186b221c6f08999f8645 GIT binary patch literal 566 zcmV-60?GY}0y6{v0SEvc79j-fe_QlxJHFT)hc=EZIX({WFBufx*dt6oKk8SR9?9PYAQBG73H+vyL+@T04 zLf53Sq-F+!@H9&Uq5EQ-(Dbm6-Uvqse^zs+sD=%S0u`4HAWX4%zAxJU!rp%XO#fcO zb>i1$-DIG&#X_a^k0ocvyJ;VGMU{EUgQ{KcM`-g02(?75O4;QUTkZD3(m95p3-4Dz zcI&;z{~r@<_7G#dgXNQFVYm*^DlN!h5kb`O0Ajp2d$fh#SF=f-@*8b@zgEnCg8qWT z(?~8~6^a736sir`IT`9-`S>QZeC?J!7S$yhImHIPWQ6KU=w0l;B`-STbhvB;QPY?)G&D^Wne|Jmr! z8nJxpe^d)n66Y)-fc7ZS>#t>awVnk_G7R-Ip$^3B)NHgaRqMZPi*I;NwK<{+8BpH4 z2Ih;jYT033>8!rzv7cdMtLuLtd%;97EWgjRNo(uGyO(m0-vfVnuO#b^uhVWNJF`Tb zrhaTgN&6rwS;4s6-h>4WVQMwp?^k|9XfdjKoldmxjROl^`b47ImVX$|$jczQsR%(> Ev~i>n3IG5A literal 0 HcmV?d00001 diff --git a/youtube_dl/extractor/freetv.py b/youtube_dl/extractor/freetv.py new file mode 100644 index 000000000..d305f2d09 --- /dev/null +++ b/youtube_dl/extractor/freetv.py @@ -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[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'

(.+?)

', webpage, 'title') + + return { + 'id': video_id, + 'title': title, + 'description': self._og_search_description(webpage), + 'uploader': self._search_regex(r']+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False), + # TODO more properties (see youtube_dl/extractor/common.py) + } \ No newline at end of file diff --git a/youtube_dl/extractor/googledrive.py b/youtube_dl/extractor/googledrive.py index d706fa968..48d9c8b4b 100644 --- a/youtube_dl/extractor/googledrive.py +++ b/youtube_dl/extractor/googledrive.py @@ -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])