Beispiel #1
0
        /// <summary>
        /// 获取非图文、视频素材
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public byte[] GetOtherMaterialById(string id)
        {
            var url  = GetAccessApiUrl("get_material", ApiName);
            var data = new
            {
                media_id = id
            };

            return(RequestUtility.HttpUploadData(url, JsonConvert.SerializeObject(data)));
        }
Beispiel #2
0
        public void NewsApiTest_Get()
        {
            var type = Apis.Material.Enums.MaterialType.video;
            //aa5fe50648fb489a8083cdd203370470.jpg
            var result      = api.Get(type);
            var tempResult  = (OtherMaterialResult)result;
            var videoresult = api.GetMaterialById <GetVideoMaterialResult>(tempResult.Items[0].MediaId);
            var bytes       = RequestUtility.HttpUploadData(videoresult.DownUrl, tempResult.Items[0].MediaId);

            File.WriteAllBytes("E://Test.mp4", bytes);
            if (!result.IsSuccess())
            {
                Assert.Fail("获取多图文信息失败,返回结果如下:" + result.DetailResult);
            }
        }