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:
parent
821e801e1e
commit
0ee48f6ffc
@ -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()
|
||||||
|
@ -457,6 +457,9 @@ class FacebookIE(InfoExtractor):
|
|||||||
or self._search_regex(r'publish_time":([\d]+)', tahoe_data.secondary, 'timestamp', default=None)
|
or self._search_regex(r'publish_time":([\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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user