Developing short video watermarking source project based on springBoot framework + IntelliJ IDEA running test + local implementation function

Keywords: JSON Java Maven Spring

One: create a maven project package for springboot

New: File – new – project
Download 1.8jdk and Maven I downloaded Maven 3.6.1 here

GroupID is the unique identifier of the project organization: general writing format: com. Company. Project name
ArtifactID is the unique identifier of the project: general writing format: project name

You need to configure maven in advance and modify the settings.xml file, which is not covered here.

2. Our watermark source code is written in src


This is my new good file. I won't explain much here.
In the java file JsonUtil, the code content is as follows

package com.rjt.common.util;
import org.springframework.util.StringUtils;
import com.alibaba.fastjson.JSON;
public class JsonUtil {
	/**
	 * Format json as a string, and then take the value according to the key
	 * @param jsonStr
	 * @param key
	 * @return
	 */
	public static String getJsonValue(String jsonStr,String key) {
		 if(StringUtils.isEmpty(jsonStr) || StringUtils.isEmpty(key)) {
			 return "";
		 } 
		 if(key.indexOf(".")==-1) {
			 if(key.indexOf("[")!=-1) {
				 int num =Integer.parseInt(TextUtil.getSubString(key, "[", "]"));
				 key=key.substring(0, key.indexOf("["));
				return  JSON.parseObject(jsonStr).getJSONArray(key).getString(num);
			 }else {
				 return JSON.parseObject(jsonStr).getString(key);
			 }
		 }else {
			 String[] keys = key.split("\\.");
			 for(int i=0;i<keys.length;i++) {
				 String tempKey=keys[i];
				 if(tempKey.indexOf("[")!=-1) {
					 int num =Integer.parseInt(TextUtil.getSubString(tempKey, "[", "]"));
					 tempKey=tempKey.substring(0, keys[i].indexOf("["));
					 jsonStr=JSON.parseObject(jsonStr).getJSONArray(tempKey).getString(num);
				 }else {
					 jsonStr=JSON.parseObject(jsonStr).getString(tempKey);
				 }
			 }
			return jsonStr;
		 }
	}
}

TextUtilde

package com.rjt.common.util;
import blade.kit.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Random;
public class TextUtil {
	private static Logger logger = LoggerFactory.getLogger(TextUtil.class);
	/**
	 * Take the text value between two texts
	 * 
	 * @param text
	 * @param left
	 * @param right
	 * @return
	 */
	public static String getSubString(String text, String left, String right) {
		String result = "";
		int zLen;
		if (left == null || left.isEmpty()) {
			zLen = 0;
		} else {
			zLen = text.indexOf(left);
			if (zLen > -1) {
				zLen += left.length();
			} else {
				zLen = 0;
			}
		}
		int yLen = text.indexOf(right, zLen);
		if (yLen < 0 || right == null || right.isEmpty()) {
			yLen = text.length();
		}
		result = text.substring(zLen, yLen);
		return result;
	}
	/**
	 * Get ip
	 * 
	 * @param request
	 * @return
	 */
	public static String getRemortIP(HttpServletRequest request) {
	     String ip = request.getHeader("x-forwarded-for"); 
       if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) {  
           // There will be multiple ip values after multiple reverse proxy. The first ip is the real ip.
           if( ip.indexOf(",")!=-1 ){
               ip = ip.split(",")[0];
           }
       }  
       if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {  
           ip = request.getHeader("Proxy-Client-IP");  
       }  
       if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {  
           ip = request.getHeader("WL-Proxy-Client-IP");  
       }  
       if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {  
           ip = request.getHeader("HTTP_CLIENT_IP");  
       }  
       if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {  
           ip = request.getHeader("HTTP_X_FORWARDED_FOR");  
       }  
       if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {  
           ip = request.getHeader("X-Real-IP");  
       }  
       if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {  
           ip = request.getRemoteAddr();  
       } 
       return ip;  
   }
	/**
	 * Get address according to ip
	 * 
	 * @param
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	public static String getPlace(String ip) throws UnsupportedEncodingException {
		if (ip.indexOf(", ") != -1) {
			ip = ip.split(", ")[1];
		}
		String url = "https://ip.cn/index.php?ip=" + ip;
		HttpRequest request = HttpRequest.get(url, true).header("User-Agent",
				"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0");
		String res = request.body();
		String place = TextUtil.getSubString(res, "Set:<code>", "</code></p><p>");
		request.disconnect();
		return place;
	}
	/**
	 * Get latitude from address
	 * 
	 * @param
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	public static String getWd(String place) throws UnsupportedEncodingException {
		String url = "http://apis.map.qq.com/jsapi?qt=poi&wd=" + URLEncoder.encode(place, "utf8");
		HttpRequest request = HttpRequest.get(url, true);
		String res = request.body();
		request.disconnect();
		return handResult(res);
	}
	/**
	 * Processing data
	 * 
	 * @param res
	 * @return
	 */
	private static String handResult(String res) {
		JSONObject json = JSON.parseObject(res);
		json = JSON.parseObject(json.get("detail").toString());
		JSONArray jsonArray = JSON.parseArray((json.get("pois").toString()));
		int ranNum = getRandomNumRang(jsonArray.size());
		json = JSON.parseObject(jsonArray.get(ranNum).toString());
		return json.get("pointx") + "," + json.get("pointy");
	}
	public static void main(String[] args) throws UnsupportedEncodingException {
		int a=0;
		for (int i=0;i<100;i++){
			String ee= getRandomNum(1);
			if(ee.equals("8")){
				System.out.println(a++);
			}
		}
	}
	/**
	 * Get dimension and precision according to ip
	 * @param
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	public static String getWd(HttpServletRequest request) throws UnsupportedEncodingException {
		String remortIP = getRemortIP(request);
		logger.info("remortIP by{}",remortIP);
		String place = getPlace(remortIP);
		logger.info("place by{}",place);
		String wd="112.537170,37.874690";
		try {
			wd = getWd(place);
		} catch (Exception e) {
			// TODO: handle exception
			logger.info("e by{}",e);
		}
		logger.info("wd by{}",wd);
		return wd;
	}
	/**
	 * Take random number
	 * 
	 * @param num
	 * @return
	 */
	public static String getRandomNum(int num) {
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < num; i++) {
			Random rnd = new Random();
			sb.append(rnd.nextInt(9));
		}
		return sb.toString();
	}
	/**
	 * Random number according to range
	 * 
	 * @param
	 * @return
	 */
	public static int getRandomNumRang(int end) {
		Random rnd = new Random();
		return rnd.nextInt(end);
	}
	public static String makeImei () {
		String imeiString=TextUtil.getRandomNum(14);
		char[] imeiChar=imeiString.toCharArray();
		int resultInt=0;
		for (int i = 0; i < imeiChar.length; i++) {
			int a=Integer.parseInt(String.valueOf(imeiChar[i]));
			i++;
			final int temp=Integer.parseInt(String.valueOf(imeiChar[i]))*2;
			final int b=temp<10?temp:temp-9;
			resultInt+=a+b;
		}
		resultInt%=10;
		resultInt=resultInt==0?0:10-resultInt;
		return imeiString+resultInt;
	}
}

VideoController

package com.rjt.video.controller;

import java.util.Objects;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.rjt.video.model.VideoModel;
import com.rjt.video.service.VideoService;
import com.rjt.video.service.impl.VideoFactory;

/**  
* @comment
* @author tanran 
* @date 2019 June 14th 2013  
* @version 1.0  
*/
@RestController
@RequestMapping("video")
@CrossOrigin
public class VideoController {
	 @GetMapping(value = "parse")
	   public VideoModel parse(String url) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
		         VideoService videoService = VideoFactory.getVideo(url);
		         if(Objects.isNull(videoService)) {
		        	 return new VideoModel();
		         }
		         return videoService.parseUrl(url);
	   }
}

VideoModel

package com.rjt.video.model;
public class VideoModel {
	//Video name
	private String name;
	//Video background
	private String cover;
	//Watermark free address
	private String playAddr;
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the cover
	 */
	public String getCover() {
		return cover;
	}
	/**
	 * @param cover the cover to set
	 */
	public void setCover(String cover) {
		this.cover = cover;
	}
	/**
	 * @return the playAddr
	 */
	public String getPlayAddr() {
		return playAddr;
	}
	/**
	 * @param playAddr the playAddr to set
	 */
	public void setPlayAddr(String playAddr) {
		this.playAddr = playAddr;
	}
	@Override
	public String toString() {
		return "VideoModel [name=" + name + ", cover=" + cover + ", playAddr=" + playAddr + "]";
	}
}

The impl file under the service file contains seven java files:
DouyinServiceImpl

package com.rjt.video.service.impl;

import org.springframework.stereotype.Service;

import com.rjt.common.util.JsonUtil;
import com.rjt.common.util.TextUtil;
import com.rjt.video.model.VideoModel;
import com.rjt.video.service.VideoService;

import blade.kit.http.HttpRequest;

/**  
* @comment
* @author tanran 
* @date 2019 June 14th 2013  
* @version 1.0  
*/
@Service
public class DouyinServiceImpl implements VideoService{

	@Override
	public VideoModel parseUrl(String url) {
		// TODO Auto-generated method stub
		VideoModel videoModel=new VideoModel();
		HttpRequest request = HttpRequest.get(url);
		String res = request.body();
		String awemeId=TextUtil.getSubString(res, "https://www.iesdouyin.com/share/video/", "/?");
		
		url ="https://api-hl.amemv.com/aweme/v1/aweme/detail/?aid=1128&app_name=aweme&version_code=251&aweme_id="+awemeId;
		request=HttpRequest.get(url).header("User-Agent","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1");
		res = request.body();
		System.out.println(res);
	    String title = JsonUtil.getJsonValue(res, "aweme_detail.share_info.share_title");
	    String playAddr = JsonUtil.getJsonValue(res, "aweme_detail.video.play_addr.url_list[0]");
	    String cover = JsonUtil.getJsonValue(res, "aweme_detail.video.origin_cover.url_list[0]");
	    videoModel.setName(title);
	    videoModel.setPlayAddr(playAddr);
	    videoModel.setCover(cover);
		return videoModel;
	}
	public static void main(String[] args) {
		System.out.println(new DouyinServiceImpl().parseUrl("http://v.douyin.com/r2w3sN/"));
	}
}

HuoShanServiceImpl

package com.rjt.video.service.impl;

import org.springframework.stereotype.Service;

import com.rjt.common.util.JsonUtil;
import com.rjt.common.util.TextUtil;
import com.rjt.video.model.VideoModel;
import com.rjt.video.service.VideoService;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**  
* @comment
* @author tanran 
* @date 2019 June 14th 2013  
* @version 1.0  
*/
@Service
public class HuoShanServiceImpl implements VideoService {

	@Override
	public VideoModel parseUrl(String url) {
		// TODO Auto-generated method stub
		VideoModel videoModel=new VideoModel();
		/*HttpRequest request = HttpRequest.get(url);
		String res = request.body();
		System.out.println(res);*/
		try {
			OkHttpClient okHttpClient = new OkHttpClient();
			Request request = new Request.Builder().url(url).build();
			Response response = okHttpClient.newCall(request).execute();
			String result=response.body().string();
			System.out.println(result);
			result=TextUtil.getSubString(result, "create({d:", "});");
			String videoId=JsonUtil.getJsonValue(result, "video.uri");
			videoModel.setPlayAddr("http://hotsoon.snssdk.com/hotsoon/item/video/_playback/?video_id="+videoId);
			videoModel.setCover(JsonUtil.getJsonValue(result, "video.cover.url_list[0]"));
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return videoModel;
	}
	
	public static void main(String[] args) {
		System.out.println(new HuoShanServiceImpl().parseUrl("https://reflow.huoshan.com/hotsoon/s/th01P3Eu700/"));
	}
}

KuaiShouServiceImpl

package com.rjt.video.service.impl;

import org.springframework.stereotype.Service;

import com.rjt.common.util.JsonUtil;
import com.rjt.common.util.TextUtil;
import com.rjt.video.model.VideoModel;
import com.rjt.video.service.VideoService;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**  
* @comment
* @author tanran 
* @date 2019 June 14th 2013  
* @version 1.0  
*/
@Service
public class KuaiShouServiceImpl implements VideoService {

	@Override
	public VideoModel parseUrl(String url) {
		// TODO Auto-generated method stub
		VideoModel videoModel=new VideoModel();
		/*HttpRequest request = HttpRequest.get(url);
		String res = request.body();
		System.out.println(res);*/
		try {
			OkHttpClient okHttpClient = new OkHttpClient();
			Request request = new Request.Builder().url(url).build();
			Response response = okHttpClient.newCall(request).execute();
			String result=response.body().string();
			String photoId=TextUtil.getSubString(result, "\\\"photoId\\\":\\\"", "\\\"");
			System.out.println(photoId);
			url="https://api.kmovie.gifshow.com/rest/n/kmovie/app/photo/getPhotoById?WS&jjh_yqc&ws&photoId="+photoId;
			request=new Request.Builder().url(url).build();
			response=okHttpClient.newCall(request).execute();
			result=response.body().string();
			 System.out.println(result);
			 videoModel.setName(JsonUtil.getJsonValue(result, "photo.caption"));
			 videoModel.setPlayAddr(JsonUtil.getJsonValue(result, "photo.mainUrl"));
			 videoModel.setCover(JsonUtil.getJsonValue(result, "photo.coverUrl"));
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return videoModel;
	}
	
	public static void main(String[] args) {
		System.out.println(new KuaiShouServiceImpl().parseUrl("http://m.chenzhongtech.com/s/mhn5haAq/"));
	}
}

PiPiXServiceImpl

package com.rjt.video.service.impl;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.springframework.stereotype.Service;

import com.rjt.common.util.JsonUtil;
import com.rjt.video.model.VideoModel;
import com.rjt.video.service.VideoService;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**  
* @comment
* @author tanran 
* @date 2019 June 14th 2013  
* @version 1.0  
*/
@Service
public class PiPiXServiceImpl implements VideoService{

	@Override
	public VideoModel parseUrl(String url) {
		// TODO Auto-generated method stub
		VideoModel videoModel=new VideoModel();
		try {
			Matcher matcher = Pattern.compile("\\d{19}").matcher(url);
			if(matcher.find()) {
				String itemId=matcher.group(0);
				url="https://is.snssdk.com/bds/item/detail/?app_name=super&aid=1319&item_id="+itemId;
				OkHttpClient okHttpClient = new OkHttpClient();
				Request request = new Request.Builder().url(url).build();
				Response response = okHttpClient.newCall(request).execute();
				String result=response.body().string();
				System.out.println(result);
				 videoModel.setName(JsonUtil.getJsonValue(result, "data.data.share.title"));
				 videoModel.setPlayAddr(JsonUtil.getJsonValue(result, "data.data.video.video_fallback.url_list[0].url"));
				 videoModel.setCover(JsonUtil.getJsonValue(result, "data.data.video.video_fallback.cover_image.url_list[0].url"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return videoModel;
	}
	public static void main(String[] args) {
		System.out.println(new PiPiXServiceImpl().parseUrl("https://h5.pipix.com/item/6677539389557446916"));
	}
}

VideoFactory

package com.rjt.video.service.impl;

import com.rjt.video.service.VideoService;

public class VideoFactory {
	public static VideoService getVideo(String type)
			throws InstantiationException, IllegalAccessException, ClassNotFoundException {

		if (type.indexOf("douyin.com") != -1 || type.indexOf("iesdouyin.com") != -1 ) {

			return DouyinServiceImpl.class.newInstance();

		} else if (type.indexOf("huoshan.com") != -1 )  {

			return HuoShanServiceImpl.class.newInstance();

		} else if (type.indexOf("kuaishou.com") != -1 || type.indexOf("gifshow.com") != -1 || type.indexOf("chenzhongtech.com") != -1) {

			return KuaiShouServiceImpl.class.newInstance();

		} else if (type.indexOf("pipix.com") != -1) {

			return PiPiXServiceImpl.class.newInstance();

		} else if (type.indexOf("weishi.qq.com")!= -1 ) {

			return WeiShiServiceImpl.class.newInstance();

		}else if (type.indexOf("izuiyou.com") != -1) {

			return ZuiYouServiceImpl.class.newInstance();

		} else {
			System.out.println("Oh dear! Can't find the corresponding instantiation class!");
			return null;
		}

	}
}

WeiShiServiceImpl

package com.rjt.video.service.impl;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.springframework.stereotype.Service;

import com.rjt.common.util.JsonUtil;
import com.rjt.video.model.VideoModel;
import com.rjt.video.service.VideoService;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**  
* @comment
* @author tanran 
* @date 2019 June 14th 2013  
* @version 1.0  
*/
@Service
public class WeiShiServiceImpl implements VideoService {

	@Override
	public VideoModel parseUrl(String url) {
		// TODO Auto-generated method stub
		VideoModel videoModel=new VideoModel();
		try {
			Matcher matcher = Pattern.compile("\\w{17}").matcher(url);
			if(matcher.find()) {
				String feedId=matcher.group(0);
				url="https://h5.qzone.qq.com/webapp/json/weishi/WSH5GetPlayPage?feedid="+feedId;
				OkHttpClient okHttpClient = new OkHttpClient();
				Request request = new Request.Builder().url(url).build();
				Response response = okHttpClient.newCall(request).execute();
				String result=response.body().string();
				System.out.println(result);
				 videoModel.setName(JsonUtil.getJsonValue(result, "data.feeds[0].material_desc"));
				 videoModel.setPlayAddr(JsonUtil.getJsonValue(result, "data.feeds[0].video_url"));
				 videoModel.setCover(JsonUtil.getJsonValue(result, "data.feeds[0].images[0].url"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return videoModel;
	}
	public static void main(String[] args) {
		System.out.println(new WeiShiServiceImpl().parseUrl("https://h5.weishi.qq.com/weishi/feed/70hxLzG4U1HlJhtUj/wsfeed?_proxy=1&_wv=1&wxplay=1&id=70hxLzG4U1HlJhtUj&spid=h5&reqseq=311149196&cover=http%3A%2F%2Fpic640.weishi.qq.com%2Fab4595845793449cb17a6df26bb6cover.jpg&bgSize=cover&image=4595845793449cb17a6df26bb6cover.&chid=100000001&pkg=3670&attach=cp_reserves3_4001&qua=v1_ht5_qz_3.0.0_001_idc_new&xflag=2130706433a1685170850b1560498191"));
	}

}

ZuiYouServiceImpl

package com.rjt.video.service.impl;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.springframework.stereotype.Service;

import com.rjt.common.util.JsonUtil;
import com.rjt.video.model.VideoModel;
import com.rjt.video.service.VideoService;

import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

/**  
* @comment
* @author tanran 
* @date 2019 June 14th 2013  
* @version 1.0  
*/
@Service
public class ZuiYouServiceImpl implements VideoService {

	@Override
	public VideoModel parseUrl(String url) {
		// TODO Auto-generated method stub
		VideoModel videoModel=new VideoModel();
		/*HttpRequest request = HttpRequest.get(url);
		String res = request.body();
		System.out.println(res);*/
		try {
			Matcher matcher = Pattern.compile("\\d{9}").matcher(url);
			if(matcher.find()) {
				String pid=matcher.group(0);
				url="https://share.izuiyou.com/api/post/detail";
				OkHttpClient okHttpClient = new OkHttpClient();
				RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), "{\"pid\":"+pid+"}");
				Request request = new Request.Builder().url(url).post(body).build();
				Response response = okHttpClient.newCall(request).execute();
				String result=response.body().string();
				System.out.println(result);
				String id=JsonUtil.getJsonValue(result, "data.post.imgs[0].id");
				 videoModel.setName(JsonUtil.getJsonValue(result, "data.post.content"));
				 videoModel.setCover(JsonUtil.getJsonValue(result, "data.post.videos."+id+".cover_urls[0]"));
				 videoModel.setPlayAddr(JsonUtil.getJsonValue(result, "data.post.videos."+id+".url"));
			}	 
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return videoModel;
	}
	
	public static void main(String[] args) {
		System.out.println(new ZuiYouServiceImpl().parseUrl("https://h5.izuiyou.com/detail/122595613?zy_to=applink&to=applink"));
	}
}

VideoService.java

package com.rjt.video.service;

import com.rjt.video.model.VideoModel;

/**  
* @comment
* @author tanran 
* @date 2019 July 24th 2013  
* @version 1.0  
* vx: 1661163785
*/
public interface VideoService {
	public VideoModel parseUrl(String url);
}

MainApplication

package com.rjt;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class MainApplication {
	public static void main(String[] args) {
		SpringApplication.run(MainApplication.class, args);
	}
}

In the application.yml file under resources, I specified the server port 80 where the program runs.

The advantage of the yml configuration file is to make the configuration more hierarchical. In the actual development process, the yml configuration file is usually selected.
Be careful:
1. Of the yml configuration file: a space must be followed, otherwise the configuration will report an error.
2. When configuring the yml file, you need to pay attention to the attribute indentation. If you indent more or less, you will change the meaning of the configuration information.

Next up is the pom.xml configuration file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!--  pom Model version-->
  <modelVersion>4.0.0</modelVersion>
<!--Project information-->
  <artifactId>rjt</artifactId>  <!-- Project name-->
  <packaging>jar</packaging> <!-- Edition-->
  <name>dyjx</name>  <!-- Project name, for maven Generated documents-->
  <!-- Parent project-->
  <parent>
    <groupId>org.springframework.boot</groupId> <!-- Unique identification of the project-->
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.6.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>

  <!-- Property settings-->
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><!-- Compile character encoding as utf-8-->
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><!-- The output character is encoded as utf-8-->
    <java.version>1.8</java.version><!-- jdk Edition-->
  </properties>
  <!-- Dependency relationship-->
  <dependencies>
    <!-- test-->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId><!-- Dependency configuration, mavendependencies Automatically manage these referenced packages-->
    </dependency>

    <!-- springmvc-->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.bladejava</groupId>
      <artifactId>blade-kit</artifactId>
      <version>1.2.9-alpha</version>
    </dependency>
    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.47</version>
    </dependency>
    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
      <version>1.11.3</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>3.14.2</version>
    </dependency>

  </dependencies>
  <!-- Compile-->
  <build>
    <finalName>${project.artifactId}</finalName>
    <!-- Plug-in unit-->
    <plugins>
      <!-- maven Plug-in unit-->
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
</project>


Now that the project code is finished, run the main program class MainApplication.
Here's the explanation: use @ SpringBootApplication to annotate a main program class, indicating that this is a SpringBoot application.

Run succeeded

You can see that the port of the startup project is 80.

Local implementation function:
I have written the web front end with html+css here

Next, we input the video address to realize the resolution.

It can also be deployed to the cloud server, which is still being debugged. I wish me success...

Posted by aeafisme23 on Wed, 16 Oct 2019 14:45:11 -0700