Douyin seo source code deployment and construction -- code sharing

1. Development environment construction

The construction of Douyin SEO source code deployment environment can be divided into the following steps:

  1. Install necessary software and tools: Node.js, NPM, Git and other software and tools need to be installed. For specific installation methods, please refer to official documents.

  2. Download source code: Download Douyin SEO source code from GitHub or other source code hosting platforms.

  3. Install dependencies: Use command line tools to enter the source code directory, execute npm installcommands, and install all dependencies.

  4. Configure environment variables: Set the necessary environment variables as system environment variables so they can be accessed from anywhere. For example, an environment variable can be set DY_CONFIG_PATHto point to the path of the configuration file.

  5. Configuration parameters: Modify the configuration file according to your own needs. You can use the default configuration, or modify the parameters as needed.

  6. Start the application: use the command line tool to enter the source code directory, execute node index.jsthe command, and start the application. If all goes well, the application will run on localhost.

The above are the basic steps of Douyin SEO source code deployment environment, which can be modified and adjusted according to actual needs.

2. Function construction and code development display

Obtain user authorization

{
    "data": {
        "access_token": "act.f7094fbffab2ecbfc45e9af9c32bc241oYdckvBKe82BPx8T******",
        "captcha": "",
        "desc_url": "",
        "description": "",
        "error_code": 0,
        "expires_in": 1296000,
        "log_id": "20230525105733ED3ED7AC56A******",",
        "open_id": "b9b71865-7fea-44cc-******",
        "refresh_expires_in": 2592000,
        "refresh_token": "rft.713900b74edde9f30ec4e246b706da30t******",
        "scope": "user_info"
    },
    "message": "success"
}

Obtain user public information:

curl --location --request POST 'https://open.douyin.com/oauth/userinfo/' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'open_id=ba253642-0590-40bc-9bdf-9a1334******' \
--data-urlencode 'access_token=act.1d1021d2aee3d41fee2d2add43456badMFZnrhFhfWotu3Ecuiuka2******'

Query video release results:

{
  "event": "create_video",
  "from_user_id": "",
  "client_key": "",
  "msg_id": "",
  "content": {
    "share_id": "",
    "item_id": "", //加密视频ID
    "video_id": "" //真实视频ID
  }
}

Receive private messages

{
  "event": "im_receive_msg",
  "client_key": "asdfavetgbvasf",
  "from_user_id": "ac6479a5-d7a6-4018-84be-c29bfc00000",
  "to_user_id": "aaa-7ae0-4399-914a-5eb1df5861ba",
  "content": {
    "conversation_short_id": "@c29bfc000+MNggFhRkwGuX1ntuc0QfA0VnmRejrzWUBwDdDYrU9MpJSYEVV6/2hKU0il5iay8J99+0t5j3zrbA==",
    "server_message_id": "@c29bfc000+MNggFhRkwGuX1ntuc0RPc0VHKefj/yWEJ8DtjUrU9MpJSYEVV6/2hKrOcqY1gIxctCXW23v4oW/Q==",
    "conversation_type": 2,
    "create_time": 1656571939562,
    "message_type": "text",
    "text": "你好,抖音"
  }
}

Group message:

{
  "event": "im_group_receive_msg",
  "client_key": "asdfavetgbvasf",
  "from_user_id": "ac6479a5-d7a6-4018-84be-c29bfc00000",
  "to_user_id": "aaa-7ae0-4399-914a-5eb1df5861ba",
  "content": {
    "conversation_short_id": "@c29bfc000+MNggFhRkwGuX1ntuc0QfA0VnmRejrzWUBwDdDYrU9MpJSYEVV6/2hKU0il5iay8J99+0t5j3zrbA==",
    "server_message_id": "@c29bfc000+MNggFhRkwGuX1ntuc0RPc0VHKefj/yWEJ8DtjUrU9MpJSYEVV6/2hKrOcqY1gIxctCXW23v4oW/Q==",
    "conversation_type": 2,
    "create_time": 1656571939562,
    "message_type": "text",
    "text": "你好,抖音"
  }
}

Emoji message

{
  "event": "im_group_receive_msg",
  "client_key": "asdfavetgbvasf",
  "from_user_id": "eeb0ea9b-bed4-4b70-913d-c29bfc00000",
  "to_user_id": "aaa-7ae0-4399-914a-5eb1df5861ba",
  "content": {
    "conversation_short_id": "@c29bfc000+MNggFhRkwGuX1ntucyQ/A1Wn+VfTX3Vk9xDdDQrU9MpJSYEVV6/2hK6gbUC8gjaV/y3CS18WtfMw==",
    "server_message_id": "@c29bfc000+MNggFhRkwGuX1ntuc1RPw2VXmSfjn/VE9zCtHSrU9MpJSYEVV6/2hKk8cLQDaYzbQpImhvw1Y4FQ==",
    "conversation_type": 2,
    "create_time": 1656671771668,
    "message_type": "emoji",
    "resource_type": "gif",
    "resource_width": 450,
    "resource_height": 450,
    "resource_url": ""
  }
}

picture message

{
  "event": "im_group_receive_msg",
  "client_key": "asdfavetgbvasf",
  "from_user_id": "ac6479a5-d7a6-4018-84be-c29bfc00000",
  "to_user_id": "8067f050-f8cf-4fa3-9357-c29bfc00000",
  "content": {
    "conversation_short_id": "@c29bfc000+MNggFhRkwGuX1ntuc0QfA0VnmRejrzWUBwDdDYrU9MpJSYEVV6/2hKU0il5iay8J99+0t5j3zrbA==",
    "server_message_id": "@c29bfc000+MNggFhRkwGuX1ntuc0RPc0VHKefj/yWEJ8DtjUrU9MpJSYEVV6/2hKrOcqY1gIxctCXW23v4oW/Q==",
    "conversation_type": 2,
    "create_time": 1656571939562,
    "message_type": "image"
  }
}

video sharing message

{
  "event": "im_group_receive_msg",
  "client_key": "asdfavetgbvasf",
  "from_user_id": "eeb0ea9b-bed4-4b70-913d-c29bfc00000",
  "to_user_id": "8067f050-f8cf-4fa3-9357-c29bfc00000",
  "content": {
    "conversation_short_id": "@c29bfc000+MNggFhRkwGuX1ntucyQ/A1Wn+VfTX3Vk9xDdDQrU9MpJSYEVV6/2hK6gbUC8gjaV/y3CS18WtfMw==",
    "server_message_id": "@c29bfc000+MNggFhRkwGuX1ntuc1RPw2VXmSfjn/VE9zCtHSrU9MpJSYEVV6/2hKk8cLQDaYzbQpImhvw1Y4FQ==",
    "conversation_type": 2,
    "create_time": 1656671771668,
    "message_type": "video",
    "item_id": "@72NwHyW53+MNggFhRkwGuX1ntuc2RfUyVnKfdTzwU0F0CtjUrU9MpJSYEVV6/2hKy3NMVbBhh6BW27IsDFieLg=="
  }
}

Retained card message (including blank state and completed state)

blank state

{
  "event": "im_group_receive_msg",
  "client_key": "asdfavetgbvasf",
  "from_user_id": "ac6479a5-d7a6-4018-84be-c29bfc00000",
  "to_user_id": "8067f050-f8cf-4fa3-9357-c29bfc00000",
  "content": {
    "conversation_short_id": "@c29bfc000+MNggFhRkwGuX1ntuc0QfA0VnmRejrzWUBwDdDYrU9MpJSYEVV6/2hKU0il5iay8J99+0t5j3zrbA==",
    "server_message_id": "@c29bfc000+MNggFhRkwGuX1ntuc0RPc0VHKefj/yWEJ8DtjUrU9MpJSYEVV6/2hKrOcqY1gIxctCXW23v4oW/Q==",
    "conversation_type": 2,
    "create_time": 1656571939562,
    "message_type": "retain_consult_card",
    "card_id": "@72MqAjfymKYS1xNrB0sG4X1iidgOeMsMbUSpQwLJb3kYzJh7eXsSr5+aH2GTsvEv",
    "card_status": 1 //1:空白态;2:完成态
  }
}

Completion

{
  "event": "im_group_receive_msg",
  "client_key": "asdfavetgbvasf",
  "from_user_id": "ac6479a5-d7a6-4018-84be-c29bfc00000",
  "to_user_id": "8067f050-f8cf-4fa3-9357-c29bfc00000",
  "content": {
    "conversation_short_id": "@c29bfc000+MNggFhRkwGuX1ntuc0QfA0VnmRejrzWUBwDdDYrU9MpJSYEVV6/2hKU0il5iay8J99+0t5j3zrbA==",
    "server_message_id": "@c29bfc000+MNggFhRkwGuX1ntuc0RPc0VHKefj/yWEJ8DtjUrU9MpJSYEVV6/2hKrOcqY1gIxctCXW23v4oW/Q==",
    "conversation_type": 2,
    "create_time": 1656571939562,
    "message_type": "retain_consult_card",
    "card_id": "@72MqAjfymKYS1xNrB0sG4X1iidgOeMsMbUSpQwLJb3kYzJh7eXsSr5+aH2GTsvEv",
    "card_status": 2, //1:空白态;2:完成态
    "card_data": [
      {
        "label": "姓名",
        "value": "Tonality"
      },
      {
        "label": "手机号",
        "value": "12345678901"
      },
      {
        "label": "城市",
        "value": "北京市北京市海淀区"
      }
    ]
  }
}

Guess you like

Origin blog.csdn.net/weixin_59086012/article/details/131596280