README
¶
Postube
Parse youtube channels, and post videos to vk.com public page, and telegram channel.
Example vk public pages:
Get started
Clone the repo
git clone git@github.com:theaidem/postube.git project_name
project_name is the name of the project without spaces ex. postube, tube_poster, etc
Copy and Define project env variables
cp .env.example .env
then edit .env file
Copy and Define main configuration file for the application
cp config/config.example.yaml config/config.yaml
Define tubes. (Your post targets collection)
without spaces, example: postube, sciencevideos, define and create config for them:
cp ./config/tube.config.example.yaml ./config/TUBE_NAME.config.yaml
TUBE_NAME is a name of the tube
...
tubes:
- postube
# - sciencevideos
# - etcmoves
...
Ok, below we will edit your ./config/TUBE_NAME.config.yaml
Firstly, let's create a Standalone app
Generate access token:
Opening OAuth Authorization Dialog:
https://oauth.vk.com/authorize?client_id=APP_ID&redirect_uri=https://vk.com&scope=73744&response_type=code&v=5.92
The APP_ID is your standalone application ID
After successful application authorization, user's browser will be redirected to redirect_uri URL specified when the authorization dialog box was opened. With that, code to receive code access key will be passed in GET parameter to the specified URL:
http://redirect_uri?code=7a6fa4dff77a228eeda56603b8f53806c883f011c40b72630bb50df056f6479e52a
Receiving "access_token":
https://oauth.vk.com/access_token?client_id=APP_ID&client_secret=APP_SECRET&code=CODE&redirect_uri=https://vk.com
The APP_ID is your standalone application ID
The APP_SECRET secret key of the standalone application
The CODE code parameter from the previous step
Example of server response:
{
"access_token":"533bacf01e11f55b536a565b57531ac114461ae8736d6506a3", "expires_in":43200,
"user_id":6492
}
Copy access_token to ./config/TUBE_NAME.config.yaml
...
# Token, for access VK API
accessToken: "access_token"
...
More about authorization see there
Create vk public page
https://vk.com/groups?w=groups_create
Paste your group id to ./config/TUBE_NAME.config.yaml
...
# Your public ID
groupID: "group_id"
...
Create telegram bot account and API token
Follow https://telegram.me/BotFather
Paste your API token to ./config/TUBE_NAME.config.yaml
...
# Token your telegram bot
token: "telegram_api_token"
...
Create telegram channel
Paste channel name to ./config/TUBE_NAME.config.yaml
...
# Name your chanel, example: "@postube"
channel: "@name"
...
Define your youtube channels ids collection
Example:
# Youtube channels ID's
channels:
# SpaceX (example!)
- UCtI0Hodo5o5dUb67FeUjDeA
# BostonDynamics (example!)
- UC7vVhkEfw4nOGp8TyDk7RcQ
Start parser, and publish content
make run
Deployment to server
This optional step, you can use your own approach for that, anyway
Makefileis your friend ;)
Edit .env vars, USER HOST APP_PATH
See comments for details
Create path and upload app files on remote server
make upload.all
Build and run docker container for app
Make sure Docker has been installed on your server
make remote.build.docker.image
and run it
make remote.run.docker.conatainer
check container logs
make remote.logs.docker.image
Configure application
You can edit config.yaml locally, and upload to server, the application will re-reading the config file automatically
make upload.config
Also, you can upload TUBE_NAME.config.yaml configs
TUBE_NAME is a name of the tube
make upload.tube.config tube=TUBE_NAME
Documentation
¶
There is no documentation for this package.