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.

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