Video resource

本文介绍了几款开源工具,包括MiroVideoConverter和VLC1.1.8,这些工具可以实现不同格式到MP4/WebM的转换。此外还提到了WebMCodec,它提供了一些与WebM相关的开源编码资源。
部署运行你感兴趣的模型镜像

您可能感兴趣的与本文相关的镜像

Linly-Talker

Linly-Talker

AI应用

Linly-Talker是一款创新的数字人对话系统,它融合了最新的人工智能技术,包括大型语言模型(LLM)、自动语音识别(ASR)、文本到语音转换(TTS)和语音克隆技术

public static void main(String[] args) { String json = "{\"authorList\":[],\"videoDuration\":\"\",\"filterDate\":\"\",\"filterClickDays\":0,\"highDefinitionSrc\":\"\",\"highDefinitionLabel\":\"\",\"lowDefinitionSrc\":\"\",\"lowDefinitionLabel\":\"\",\"linkList\":[],\"schema\":\"{\\r\\n \\\"type\\\": \\\"layout-editor-collapse\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"active\\\": 0,\\r\\n \\\"labelWidth\\\": \\\"140px\\\"\\r\\n },\\r\\n \\\"components\\\": [\\r\\n {\\r\\n \\\"type\\\": \\\"layout-editor-collapse-item\\\",\\r\\n \\\"attributes\\\": {},\\r\\n \\\"components\\\": [\\r\\n {\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者列表\\\",\\r\\n \\\"labelEN\\\": \\\"Author List\\\",\\r\\n \\\"attributePath\\\": \\\"authorList\\\"\\r\\n },\\r\\n \\\"type\\\": \\\"editor-adder\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"labelPosition\\\": \\\"left\\\",\\r\\n \\\"body\\\": [\\r\\n {\\r\\n \\\"type\\\": \\\"editor-author-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"authorName\\\",\\r\\n \\\"group-attrs\\\": [\\r\\n \\\"authorPath\\\",\\r\\n \\\"authorAvatarUrl\\\",\\r\\n \\\"authorDescription\\\"\\r\\n ]\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者名称\\\",\\r\\n \\\"labelEN\\\": \\\"Name\\\",\\r\\n \\\"attributePath\\\": \\\"authorName\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者头像\\\",\\r\\n \\\"labelEN\\\": \\\"Avatar\\\",\\r\\n \\\"attributePath\\\": \\\"authorAvatarUrl\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"图片替代文字\\\",\\r\\n \\\"labelEN\\\": \\\"Image Alt text\\\",\\r\\n \\\"attributePath\\\": \\\"alt\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者描述\\\",\\r\\n \\\"labelEN\\\": \\\"Description\\\",\\r\\n \\\"attributePath\\\": \\\"authorDescription\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"作者路径\\\",\\r\\n \\\"labelEN\\\": \\\"Author Path\\\",\\r\\n \\\"attributePath\\\": \\\"authorPath\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"当前页面视频时长\\\",\\r\\n \\\"labelEN\\\": \\\"Current Page Video Duration\\\",\\r\\n \\\"attributePath\\\": \\\"videoDuration\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"Filter Date\\\",\\r\\n \\\"attributePath\\\": \\\"filterDate\\\"\\r\\n },\\r\\n \\\"type\\\": \\\"editor-datepicker\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"value\\\": \\\"\\\",\\r\\n \\\"type\\\": \\\"date\\\",\\r\\n \\\"format\\\": \\\"yyyy-MM-dd\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-numeric\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"筛选点击天数\\\",\\r\\n \\\"labelEN\\\": \\\"Filter Click Days\\\",\\r\\n \\\"attributePath\\\": \\\"filterClickDays\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"layout-editor-collapse-item\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"labelPosition\\\": \\\"left\\\"\\r\\n },\\r\\n \\\"components\\\": [\\r\\n {\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"去重链接列表\\\",\\r\\n \\\"labelEN\\\": \\\"Deduplicate Link List\\\",\\r\\n \\\"attributePath\\\": \\\"linkList\\\"\\r\\n },\\r\\n \\\"type\\\": \\\"editor-adder\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"labelPosition\\\": \\\"left\\\",\\r\\n \\\"body\\\": [\\r\\n {\\r\\n \\\"type\\\": \\\"editor-page-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"pageUrl\\\"\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"链接地址\\\",\\r\\n \\\"labelEN\\\": \\\"Link Address\\\",\\r\\n \\\"attributePath\\\": \\\"linkHref\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n ]\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-asset-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"video\\\"\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"高清晰视频资源地址\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Video Resource URL\\\",\\r\\n \\\"attributePath\\\": \\\"highDefinitionSrc\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"高清晰类型\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Label\\\",\\r\\n \\\"attributePath\\\": \\\"highDefinitionLabel\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-asset-select\\\",\\r\\n \\\"attributes\\\": {\\r\\n \\\"asset-type\\\": \\\"video\\\"\\r\\n },\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"低清晰视频资源地址\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Video Resource URL\\\",\\r\\n \\\"attributePath\\\": \\\"lowDefinitionSrc\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"type\\\": \\\"editor-input\\\",\\r\\n \\\"layoutItem\\\": {\\r\\n \\\"label\\\": \\\"低清晰类型\\\",\\r\\n \\\"labelEN\\\": \\\"High Definition Label\\\",\\r\\n \\\"attributePath\\\": \\\"lowDefinitionLabel\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n ]\\r\\n}\",\"schemaVersion\":36,\"schemaCode\":\"huaweitechArticlesTechtalksDetailsTemplate\",\"schemaName\":\"华为技术文章techtalks详情模板\"}"; String result = processJson(json); System.out.println(result); }根据上述代码,写一个processJson方法,去除json 字符串中的标签字段,只保留纯文本,应该如何处理
最新发布
09-03
以下是一个 Java 实现的 `processJson` 方法,用于去除 JSON 字符串中的标签字段,只保留纯文本。这里假设 JSON 结构中的标签字段是指包含 HTML 标签的字段,使用正则表达式来去除这些标签。 ```java import org.json.JSONObject; import java.util.regex.Pattern; public class JsonProcessor { // 用于去除 HTML 标签的正则表达式模式 private static final Pattern HTML_TAG_PATTERN = Pattern.compile("<[^>]*>"); public static String processJson(String jsonStr) { try { // 将 JSON 字符串解析为 JSONObject JSONObject jsonObject = new JSONObject(jsonStr); // 处理 JSONObject processJsonObject(jsonObject); // 将处理后的 JSONObject 转换回 JSON 字符串 return jsonObject.toString(); } catch (Exception e) { // 处理异常,这里简单地打印异常信息 e.printStackTrace(); return null; } } private static void processJsonObject(JSONObject jsonObject) { // 遍历 JSONObject 的所有键 for (String key : jsonObject.keySet()) { Object value = jsonObject.get(key); if (value instanceof String) { // 如果值是字符串,去除其中的 HTML 标签 String text = (String) value; text = removeHtmlTags(text); jsonObject.put(key, text); } else if (value instanceof JSONObject) { // 如果值是嵌套的 JSONObject,递归处理 processJsonObject((JSONObject) value); } } } private static String removeHtmlTags(String text) { // 使用正则表达式替换 HTML 标签为空字符串 return HTML_TAG_PATTERN.matcher(text).replaceAll(""); } public static void main(String[] args) { String jsonStr = "{\"name\": \"<b>John</b>\", \"description\": \"<p>This is a <i>description</i>.</p>\"}"; String processedJson = processJson(jsonStr); System.out.println(processedJson); } } ``` ### 代码解释 1. **`processJson` 方法**:该方法接收一个 JSON 字符串作为输入,将其解析为 `JSONObject`,然后调用 `processJsonObject` 方法处理该对象,最后将处理后的 `JSONObject` 转换回 JSON 字符串返回。 2. **`processJsonObject` 方法**:该方法递归地处理 `JSONObject` 中的所有键值对。如果值是字符串,则调用 `removeHtmlTags` 方法去除其中的 HTML 标签;如果值是嵌套的 `JSONObject`,则递归调用 `processJsonObject` 方法处理。 3. **`removeHtmlTags` 方法**:该方法使用正则表达式 `<[^>]*>` 匹配并替换所有 HTML 标签为空字符串。 ### 复杂度分析 - **时间复杂度**:$O(n)$,其中 $n$ 是 JSON 字符串的长度。因为需要遍历 JSON 字符串中的每个字符。 - **空间复杂度**:$O(n)$,主要用于存储处理后的 JSON 字符串。 ### 注意事项 - 该实现假设 JSON 字符串是有效的,并且不包含复杂的嵌套结构。如果 JSON 字符串包含数组或其他复杂结构,可能需要进一步扩展代码。 - 正则表达式只能处理简单的 HTML 标签,对于复杂的 HTML 标签或嵌套标签可能无法完全处理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值