fune/dom/media/test/marionette/yttest/download.py
Tarek Ziadé fbf4fdacfb Bug 1527620 - Add youtube streaming tests - r=whimboo
This patch introduces a new marionette media test along
with a Youtube test.

To run the Youtube streaming test locally:

./mach marionette-test dom/media/test/marionette/test_youtube.py -vv --gecko-log -

Differential Revision: https://phabricator.services.mozilla.com/D23644

--HG--
extra : moz-landing-system : lando
2019-04-02 15:09:47 +00:00

17 lines
628 B
Python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
from pytube import YouTube
def download_streams(video_id, output_path="data"):
yt = YouTube("https://youtube.com/watch?v=%s" % video_id)
for stream in yt.streams.all():
fn = "%s-%s-%s.%s" % (video_id, stream.itag, stream.type, stream.subtype)
stream.download(output_path="data", filename=fn)
print("%s downloaded" % fn)
if __name__ == "__main__":
download_streams(sys.argv[-1])