1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 07:07:19 +08:00

get timestamp for paid videos (#348)

Co-authored-by: bhodaya <bhodaya@videocites.com>
This commit is contained in:
hodayabu 2020-07-23 11:30:22 +03:00 committed by GitHub
parent 821e801e1e
commit 0ee48f6ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -64,6 +64,15 @@ class facebookMetaData(unittest.TestCase):
except DownloadError: except DownloadError:
self.assertRaises(DownloadError) self.assertRaises(DownloadError)
def test_paid_videos_timestamp(self):
params = {}
url = "https://www.facebook.com/148456285190063/videos/307226959975478"
ydl = youtube_dl.YoutubeDL(params)
info = ydl.extract_info(url, download=False)
print (info.get('timestamp'))
self.assertTrue(info.get('timestamp'))
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -457,6 +457,9 @@ class FacebookIE(InfoExtractor):
or self._search_regex(r'publish_time&quot;:([\d]+)', tahoe_data.secondary, 'timestamp', default=None) or self._search_regex(r'publish_time&quot;:([\d]+)', tahoe_data.secondary, 'timestamp', default=None)
timestamp = int_or_none(regex_search_result_date_time) or int_or_none(regex_search_result_publish_time) timestamp = int_or_none(regex_search_result_date_time) or int_or_none(regex_search_result_publish_time)
if timestamp is None and webpage.find('Paid Partnership') > -1:
timestamp = self._search_regex(r'"publish_time\\":(.+?),', webpage, 'timestamp', default=None, fatal=False)
uploader_id = self._resolve_uploader_id(webpage, tahoe_data) uploader_id = self._resolve_uploader_id(webpage, tahoe_data)
thumbnail = self._resolve_thumbnail(webpage, tahoe_data) thumbnail = self._resolve_thumbnail(webpage, tahoe_data)