Douyin Matrix System Source Code Deployment Technology Sharing--Based on Douyin Open Platform

Development overview

Based on the demands of developers and related platform rules, the open platform provides two open modes: capability openness and industry openness.

Self-developed developer introduction

Self-developed developers refer to those who have their own self-operated business, or have a variety of franchise roles, and can provide complete technical solutions based on user needs.

Technology Development Layout

Through continuous technological innovation and user demand analysis, we will pay more attention to the personalized development of this set of short video matrix source code system. Currently, the basic functions covered in the market include video editing, binding release, smart reply, data statistics and other basic functions. . In addition, we did a lot of optimization during development, such as server clustering, parallelization, 1080p resolution, etc., and developed it from the perspective of the market (Tik Tok applets, local life services, and opened up the layout and development of mobile terminals)

Source code deployment and build sharing

Compared with other systems, the difficulty of developing and deploying this system lies mainly in the application of the official application permissions of each platform. According to the editor, the current quota of some permissions on the Douyin short video platform is full. Before developing, you must first ensure that you have obtained various development permissions.

Deployment environment construction

  1.  Install a Python interpreter on your cloud server. You can use the following command to check if Python is installed:

    python -V
    

    If Python is not installed, you can install it with the following command:

    sudo apt-get update
    sudo apt-get install python
    
  2. Install pip, the package manager for Python. You can use the following command to install:

    sudo apt-get install python-pip
    
  3. Install virtualenv, which is a virtual environment for Python. This will help you use different versions of Python on the same computer.

    pip install virtualenv
    
  4. Create a new virtual environment.

    virtualenv venv
    
  5. Activate the virtual environment.

    source venv/bin/activate
    
  6. Install required dependencies.

Code Development Example

Scenario: Trigger the bound onChange callback when the properties of the common object are changed;

Idea: There are two traps that can change properties, set and deleteProperty, and just call the onChange method in them

sample request

curl --location --request GET 'https://open.douyin.com/item/comment/list/?open_id=ba253642-0590-40bc-9bdf-9a1334b94059&cursor=0&count=10&item_id=@8hxdhauTCMppanGnM4ltGM780mDqPP+KPpR0qQOmLVAXb/T060zdRmYqig357zEBq6CZRp4NVe6qLIJW/V/x1w==&sort_type=time' \
--header 'access-token: act.1d1021d2aee3d41fee2d2add43456badMFZnrhFhfWotu3Ecuiuka27L56lr' \

Sample response:

{
  "extra": {
    "sub_description": "",
    "logid": "202008121419360101980821035705926A",
    "now": 1597213176393,
    "error_code": 0,
    "description": "",
    "sub_error_code": 0
  },
  "data": {
    "cursor": 1,
    "error_code": 0,
    "description": "",
    "has_more": true,
    "list": [
      {
        "top": true,
        "comment_id": "",
        "comment_user_id": "",
        "content": "回复内容",
        "create_time": 1607399832,
        "digg_count": 647,
        "reply_comment_total": 12
      }
    ]
  }
}

Code demonstration sample

* Create engineering project
     */
    public function createProjectAction() {         $this->useLayout('dydqtshoppc-head.html');         $id = $this->request->getIntParam('id');

        //获取视频信息
        $video_model    = new App_Model_Douyin_MysqlVideoStorage();
        $video_info     = $video_model->getRowByIdSid($id, $this->sid);
        $use_platform   = empty($video_info['dv_use_platform']) ? [] : json_decode($video_info['dv_use_platform'], 1);

        if (!empty($video_info)) {
            $video_cfg  = empty($video_info['dv_platform']) ? null : json_decode($video_info['dv_platform'], 1);
        }

        //Video mixed cutting mode
        $video_mixed_mode = plum_parse_config('project_mixed_mode','dydqt/project');

        $this->output['video_info']     = $video_info;
        $this->output['use_platform']   = $use_platform;
        $this->output['video_cfg']      = empty($video_cfg) ? null : $video_cfg;
        $this->output['video_mixed_mode']   = $video_mixed_mode;
        $this->output['font_map']   = (new App_Plugin_Ffmpeg_VideoPlugin())->getFontMap();
        $color_list = plum_parse_config('color_list', 'config');
        $this->output['color_list'] = $color_list;
        //火山引擎、腾讯云配音
        $huoshan_vcn    = plum_parse_config('hsyq_vcn', 'system');
        $tencent_vcn    = plum_parse_config('txy_vcn', 'system');
        $this->output['audio_vcn']  = empty($tencent_vcn) ? $huoshan_vcn : $tencent_vcn;
        $this->output['platform_list']  = plum_parse_config('platform_list', 'dydqt/project');
        $this->displaySmarty('dydqtshoppc/video/create-project.tpl');
    }   

 /*
     * 添加/编辑视频
     */
    public function addVideoAction(){
        $this->useLayout('dydqtshoppc-head.html');
        $id     = $this->request->getIntParam('id');

        //获取视频信息
        $Video_model    = new App_Model_Douyin_MysqlVideoStorage();
        $video_info     = $Video_model->getRowByIdSid($id, $this->sid);

        //视频混剪模式
        $video_mixed_mode = plum_parse_config('project_mixed_mode','dydqt/project');

        $this->output['video_info']     = $video_info;
        $this->output['video_mixed_mode']   = $video_mixed_mode;
        $this->displaySmarty('dydqtshoppc/video/addVideo.html');
    }
    /*
     * 保存工程配置
     */
    public function saveItemConfigAction() {
        $dv_id  = $this->request->getIntParam('dv_id');
        unset($_REQUEST['q']);
        unset($_REQUEST['dv_id']);
        //获取视频信息
        $video_model    = new App_Model_Douyin_MysqlVideoStorage();
        $video_info     = $video_model->getRowByIdSid($dv_id, $this->sid);
        if (empty($video_info)) {
            $this->displayJsonError('参数错误');
        }
        $curr_platform  = json_decode($video_info['dv_platform'], 1);
        $curr_platform  = is_null($curr_platform) ? [] : $curr_platform;
        //发音人合集
        if (isset($_REQUEST['a_vcn'])) {
            $vcn    = $this->request->getStrParam('a_vcn');
            $vcn    = explode(',', $vcn);
            unset($_REQUEST['a_vcn']);
            $curr_platform['vcn']   = array_combine($vcn, $vcn);
        }








Guess you like

Origin blog.csdn.net/buda_l/article/details/131594581