/// <summary> /// 采集商品消息 /// </summary> /// <param name="collectPlaformType"></param> /// <param name="TextContent"></param> /// <returns></returns> public static CollectMessageEntity CollectGoodMessage(CollectPlaformType collectPlaformType, string TextContent) { CollectMessageEntity collectMessageEntity = null; try { collectMessageEntity = new CollectMessageEntity(); collectMessageEntity.PlaformType = collectPlaformType; collectMessageEntity.MessageType = CollectMessageType.Text; collectMessageEntity.InitMessageContent = TextContent;//初始消息内容 List <CollectGoodInfo> CollectGoodList = new List <CollectGoodInfo>(); bool returnStatus = false; #region 开始解析文本内容 switch (collectPlaformType) { case CollectPlaformType.TaoBao: #region 开始解析淘宝商品 returnStatus = RegularHelper.GoodRegularParseByTB_Mutiple(ref TextContent, ref CollectGoodList); #endregion break; case CollectPlaformType.JD: #region 开始解析京东商品 returnStatus = RegularHelper.GoodRegularParseByJD_Mutiple(ref TextContent, ref CollectGoodList); #endregion break; case CollectPlaformType.PDD: #region 开始解析拼多多商品 returnStatus = RegularHelper.GoodRegularParseByPDD_Mutiple(ref TextContent, ref CollectGoodList); #endregion break; default: break; } if (returnStatus) { collectMessageEntity.MessageContent = TextContent; collectMessageEntity.CollectGoodList = CollectGoodList; collectMessageEntity.url_list = RegularHelper.GetUrlList(collectMessageEntity.InitMessageContent); } #endregion } catch (Exception ex) { LogHelper.WriteException("CollectMessage", ex); } return(collectMessageEntity); }
public static string ClearDouYinWater(string douyin_video_url) { string playAddr = ""; try { /*第一步:解析抖音视频短链接获取视频id *第二步:根据视频id获取原始视频地址 *第三步: 替换原始地址中的信息得到无水印视频 */ douyin_video_url = RegularHelper.getValue(@"(https|http)(://v.douyin.com/[a-zA-Z0-9]{7,})", douyin_video_url); string resultContent = AjaxRequest.GetRedirectUrl(douyin_video_url);//获取视频重定向地址 string item_id = RegularHelper.getValue("(?<=(video/)).*?(?=(/))", resultContent); if (item_id.IsEmpty()) { throw new Exception("未解析到视频ID!"); } var webHtml = AjaxRequest.HttpGet("https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=" + item_id, ""); item_video_list_Entity item_Video_List_Entity = Newtonsoft.Json.JsonConvert.DeserializeObject <item_video_list_Entity>(webHtml); if (!item_Video_List_Entity.IsEmpty() && item_Video_List_Entity.item_list.Count > 0) { List <string> url_List = item_Video_List_Entity.item_list[0].video.play_addr.url_list; if (url_List.Count > 0) { playAddr = url_List[0].Replace("playwm", "play"); } else { throw new Exception("未解析到视频信息!"); } } else { throw new Exception("未解析到视频信息!"); } } catch (Exception ex) { throw new Exception(ex.Message); } return(playAddr); }