一、 开发环境搭建
抖音SEO源码部署环境搭建可以分为以下几个步骤:
-
安装必要的软件和工具:需要安装Node.js、NPM、Git等软件和工具,具体安装方法可以参考官方文档。
-
下载源码:从GitHub或其他源码托管平台下载抖音SEO源码。
-
安装依赖项:使用命令行工具进入源码目录,执行
npm install
命令,安装所有依赖项。 -
配置环境变量:将必要的环境变量设置为系统环境变量,这样可以在任何地方访问它们。例如,可以设置
DY_CONFIG_PATH
环境变量,指向配置文件的路径。 -
配置参数:根据自己的需求修改配置文件。可以使用默认配置,也可以根据需要修改其中的参数。
-
启动应用程序:使用命令行工具进入源码目录,执行
node index.js
命令,启动应用程序。如果一切顺利,应用程序将在本地主机上运行。
以上是抖音SEO源码部署环境的基本步骤,可以根据实际需求进行适当修改和调整。
二、 功能构建及代码开发展示
获取用户授权
{
"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"
}
获取用户公开信息:
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******'
查询视频发布结果:
{
"event": "create_video",
"from_user_id": "",
"client_key": "",
"msg_id": "",
"content": {
"share_id": "",
"item_id": "", //加密视频ID
"video_id": "" //真实视频ID
}
}
接收私信消息
{
"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": "你好,抖音"
}
}
群消息:
{
"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": "你好,抖音"
}
}
表情消息
{
"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": ""
}
}
图片消息
{
"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"
}
}
视频分享消息
{
"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=="
}
}
留资卡片消息(包含空白态和完成态)
空白态
{
"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:完成态
}
}
完成态
{
"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": "北京市北京市海淀区"
}
]
}
}