在C#中切出HTML字符串的特定部分

问题描述 投票:-1回答:1

你好,我想将此HTML缩减为字符串输出-> FULL HTML https://pastebin.com/qT97gBh5

[{"@context":"http://schema.org","@type":"VideoObject","thumbnailUrl":["https://static-cdn.jtvnw.net/previews-ttv/live_user_monstercat-{width}x{height}.jpg"],"embedUrl":"https://player.twitch.tv/?channel=monstercat&player=facebook&autoplay=true","name":"Monstercat - Twitch","description":"Non Stop Music - Monstercat Radio 🎶","videoQuality":"1080p","publication":{"@type":"BroadcastEvent","isLiveBroadcast":true,"startDate":"03/29/2020 19:04:06"},"author":{"@type":"Person","name":"Monstercat","url":"https://www.twitch.tv/monstercat"}

字符串输出=“不间断音乐-Monstercat Radio🎶”

字符串输出将始终具有不同的内容。

c# regex string trim
1个回答
1
投票

您可以在c#中搜索有关敏捷性包的信息,然后使用敏捷性获取此X路径

/html/head/script[2]

现在您有一个json字符串。使用newtonsoft将json转换为属性(使用Nuget添加此程序包)。恭喜,您可以在课堂上阅读说明。

© www.soinside.com 2019 - 2024. All rights reserved.