Skip to content

Commit

Permalink
Included workaround RobbieClarken#5 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasPP committed Sep 1, 2019
1 parent 57fb158 commit 93133f3
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/runConfigurations/channel_to_playlist.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/src.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion channel_to_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def get_authenticated_service(args):
credentials = storage.get()
if credentials is None or credentials.invalid:
credentials = run_flow(flow, storage, args)
return build("youtube", "v3", http=credentials.authorize(httplib2.Http()))

fiddler_proxy_traffic_testing = False # if true set env variable: set HTTPS_PROXY=http://127.0.0.1:8888
http = httplib2.Http(disable_ssl_certificate_validation=fiddler_proxy_traffic_testing)
return build("youtube", "v3", http=credentials.authorize(http))


def get_channel_upload_playlist_id(youtube, channel_id):
Expand Down Expand Up @@ -137,6 +140,18 @@ def _parse_args(args):
dest="published_before",
help="Only add videos published before this date",
)

argparser.add_argument(
"--noauth_local_webserver",
action='store_true',
default=False,
help='Do not run a local web server.',
)
argparser.add_argument(
'--logging_level', default='ERROR',
choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
help='Set the logging level of detail.')

argparser.add_argument("channel_id", help="id of channel to copy videos from")
argparser.add_argument("playlist_id", help="id of playlist to add videos to")
parsed = argparser.parse_args(args)
Expand Down
14 changes: 14 additions & 0 deletions notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
https://developers.google.com/youtube/v3/getting-started#quota
A simple read operation that only retrieves the ID of each returned resource has a cost of approximately 1 unit.
A write operation has a cost of approximately 50 units.
A video upload has a cost of approximately 1600 units.

cost of queries for each operation in google cloud console
0queries get_authenticated_service
3queries get_channel_upload_playlist_id
69queries get_playlist_video_ids() from channel with 1090videos.
~50queries add_video_to_playlist to add just one video

1500 queries for 3mb of traffic. 63 http requests. adding 27 video to existing 200 videos playlist from channel with 1000 videos.

set HTTPS_PROXY=http://127.0.0.1:8888

0 comments on commit 93133f3

Please sign in to comment.