Skip to content

Import Channel command line

Daniel Neto edited this page Jul 15, 2022 · 2 revisions

We built a tool that is capable of importing videos from one AVideo Channel to another, even on different sites/domains. this tool can be useful in situations where you want to migrate content. but it is important to point out that the links and primary keys (videos_id) will not be the same as the original site.

the file can be found here https://github.com/WWBN/AVideo/blob/master/install/importChannel.php

This script will import all videos from a specific channel to a specific user account using the API (so the API MUST be enabled on the source site channel). The final result will depend on the video type

  • MP4 or MP3 we will also download the video
  • All other formats we will only import the database metadata poster and images
  • We cannot download the HLS video, so to make it work you will need to copy the video folder itself, do not rename the folder because we always import it with the same filename
  • Embed videos should work with no problem Initially, we will ask you for the URL of an AVideo channel and then we will ask you for a user id. If you do not know the id we will offer you a search to facilitate the location The category will be the site's default If you run the script again, we will NOT duplicate the video but we will update the metadata with the source site channel

Command line sample ...

$ cd /var/www/html/AVideo/install
$ php importChannel.php
[2022-07-15 18:26:52] AVideoLog::DEBUG: _mysql_connect HOST=localhost,DB=avideo SCRIPT_NAME: importChannel.php


****************************************Channel Import Tool****************************************
This script will import all videos from a specific channel to a specific user account using the API (so the API MUST be enabled on the source site channel).
The final result will depend on the video type
- MP4 or MP3 we will also download the video
- All other formats we will only import the database metadata poster and images
- We cannot download the HLS video, so to make it work you will need to copy the video folder itself, do not rename the folder because we always import it with the same filename
- Embed videos should work with no problem
Initially, we will ask you for the URL of an AVideo channel and then we will ask you for a user id.
If you do not know the id we will offer you a search to facilitate the location
The category will be the site's default
If you run the script again, we will NOT duplicate the video but we will update the metadata with the source site channel
****************************************Channel Import Tool****************************************


Enter a Channel URL to import: https://demo.avideo.com/channel/MovieclipsTrailers
importChannel: start https://demo.avideo.com/ MovieclipsTrailers
Enter username or user ID:1
Do you want to limit the max of videos imported? just press enter for unlimited:2
importChannel: SUCCESS https://demo.avideo.com/plugin/API/get.json.php?APIName=video&channelName=MovieclipsTrailers&rowCount=50&current=1
importChannel: JSON SUCCESS totalRows=7

importChannel: Video NOT found
importChannel: Saving video
importChannel: Video saved 59 downloading poster and images ...
importChannel::download [/var/www/html/AVideo/videos/_YPTuniqid_5c5d54ade2f225.91030530/_YPTuniqid_5c5d54ade2f225.91030530.jpg]
importChannel::download [/var/www/html/AVideo/videos/_YPTuniqid_5c5d54ade2f225.91030530/_YPTuniqid_5c5d54ade2f225.91030530.webp]

importChannel: Video NOT found
importChannel: Saving video
importChannel: Video saved 60 downloading poster and images ...
importChannel::download [/var/www/html/AVideo/videos/_YPTuniqid_5c5d54b031e1e5.33517653/_YPTuniqid_5c5d54b031e1e5.33517653.jpg]
importChannel::download [/var/www/html/AVideo/videos/_YPTuniqid_5c5d54b031e1e5.33517653/_YPTuniqid_5c5d54b031e1e5.33517653.webp]

****************************************Channel Import Limit reached****************************************
You have set the maximum of 2 videos
Clone this wiki locally