Scripting way to upload videos to peertube and youtube
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
4.1 KiB

6 years ago
6 years ago
6 years ago
6 years ago
  1. # Prismedia
  2. A scripting way to upload videos to peertube and youtube
  3. ## Dependencies
  4. Search in your package manager, otherwise use ``pip install --upgrade``
  5. - google-auth
  6. - google-auth-oauthlib
  7. - google-auth-httplib2
  8. - google-api-python-client
  9. - docopt
  10. - schema
  11. - python-magic
  12. - requests-toolbelt
  13. ## Configuration
  14. Edit peertube_secret and youtube_secret.json with your credentials.
  15. ### Peertube
  16. Set your credentials, peertube server URL.
  17. You can set ``OAUTHLIB_INSECURE_TRANSPORT`` to 1 if you do not use https (not recommended)
  18. ### Youtube
  19. Youtube uses combination of oauth and API access to identify.
  20. **Credentials**
  21. The first time you connect, prismedia will open your browser to as you to authenticate to
  22. Youtube and allow the app to use your Youtube channel.
  23. **It is here you choose which channel you will upload to**.
  24. Once authenticated, the token is stored inside the file ``.youtube_credentials.json``.
  25. Prismedia will try to use this file at each launch, and re-ask for authentication if it does not exist.
  26. **Oauth**:
  27. The default youtube_secret.json should allow you to upload some videos.
  28. If you plan an larger usage, please consider creating your own youtube_secret file:
  29. - Go to the [Google console](https://console.developers.google.com/).
  30. - Create project.
  31. - Side menu: APIs & auth -> APIs
  32. - Top menu: Enabled API(s): Enable all Youtube APIs.
  33. - Side menu: APIs & auth -> Credentials.
  34. - Create a Client ID: Add credentials -> OAuth 2.0 Client ID -> Other -> Name: prismedia1 -> Create -> OK
  35. - Download JSON: Under the section "OAuth 2.0 client IDs". Save the file to your local system.
  36. - Save this JSON as your youtube_secret.json file.
  37. ## How To
  38. Currently in heavy development
  39. Support only mp4 for cross compatibility between Youtube and Peertube
  40. Simply upload a video:
  41. ```
  42. ./prismedia_upload.py --file="yourvideo.mp4"
  43. ```
  44. Specify description and tags:
  45. ```
  46. ./prismedia_upload.py --file="yourvideo.mp4" -d "My supa description" -t "tag1,tag2,foo"
  47. ```
  48. Use --help to get all available options:
  49. ```
  50. ./prismedia_upload.py --help
  51. prismedia_upload - tool to upload videos to Peertube and Youtube
  52. Usage:
  53. prismedia_upload.py --file=<FILE> [options]
  54. prismedia_upload.py -h | --help
  55. prismedia_upload.py --version
  56. Options:
  57. --name=NAME Name of the video to upload. [default: video filename]
  58. -d, --description=STRING Description of the video. [default: default description]
  59. -t, --tags=STRING Tags for the video. comma separated
  60. -c, --category=STRING Category for the videos, see below. [default: Films]
  61. --cca License should be CreativeCommon Attribution (affects Youtube upload only)
  62. -p, --privacy=STRING Choose between public, unlisted or private. [default: private]
  63. --disable-comments Disable comments (Peertube only) [default: comments are enabled]
  64. --nsfw Set the video as No Safe For Work (Peertube only as YT API does not support) [default: video is safe]
  65. -h --help Show this help.
  66. --version Show version.
  67. Categories:
  68. Category is the type of video you upload. Default is films.
  69. Here are available categories from Peertube and Youtube:
  70. music, films, vehicles,
  71. sports, travels, gaming, people,
  72. comedy, entertainment, news,
  73. how to, education, activism, science & technology,
  74. science, technology, animals
  75. ```
  76. ## Features
  77. - [x] Youtube upload
  78. - [x] Peertube upload
  79. - Support of all videos arguments (description, tags, category, licence, ...)
  80. - [x] description
  81. - [x] tags
  82. - [x] categories
  83. - [x] license: cca or not (Youtube only as Peertube uses Attribution by design)
  84. - [x] privacy (between public, unlisted or private)
  85. - [x] enabling/disabling comment (Peertube only as Youtube API does not support it)
  86. - [x] nsfw (Peertube only as Youtube API does not support it)
  87. - ~~thumbnail/preview~~ Canceled, waiting for Youtube's API support
  88. - [ ] Use a config file (NFO) file to retrieve videos arguments
  89. - [ ] Record and forget: put the video in a directory, and the script uploads it for you
  90. - [ ] Usable on Desktop (Linux and/or Windows and/or MacOS)
  91. - [ ] Graphical User Interface
  92. ## Sources
  93. inspired by [peeror](https://git.drycat.fr/rigelk/Peeror) and [youtube-upload](https://github.com/tokland/youtube-upload)