add facebook test
This commit is contained in:
parent
e7a5a1e20f
commit
40980833f7
31
test/ci/test_facebook.py
Normal file
31
test/ci/test_facebook.py
Normal file
@ -0,0 +1,31 @@
|
||||
import unittest
|
||||
import youtube_dl
|
||||
|
||||
|
||||
class facebookMetaData(unittest.TestCase):
|
||||
def test_metadata_fetch(self):
|
||||
params = {}
|
||||
url = "https://www.facebook.com/iihfhockey/videos/2742345396033296/"
|
||||
ydl = youtube_dl.YoutubeDL(params)
|
||||
info = ydl.extract_info(url, download=False)
|
||||
self.assertTrue(info.has_key('like_count'))
|
||||
self.assertTrue(info.has_key('reactions_count'))
|
||||
|
||||
def _test_metadata_fetch_with_log_in(self):
|
||||
url = "https://www.facebook.com/iihfhockey/videos/2742345396033296/"
|
||||
params = {}
|
||||
with open("cookie_file") as file:
|
||||
proxy = "ec2-35-175-164-238.compute-1.amazonaws.com:3128"
|
||||
params['cookiefile'] = file.name
|
||||
params['proxy'] = proxy
|
||||
ydl = youtube_dl.YoutubeDL(params)
|
||||
info = ydl.extract_info(url, download=False)
|
||||
self.assertTrue(info.get('timestamp'))
|
||||
self.assertTrue(info.get('view_count'))
|
||||
self.assertTrue(info.get('width'))
|
||||
self.assertTrue(info.get('uploader_id'))
|
||||
self.assertTrue(info.get('thumbnail'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
x
Reference in New Issue
Block a user