Transcode the media again. Only status is FAILED or PUBLISHED media can use.

@param mediaId The unique ID for each media resource
@return
761117
public ReTranscodeResponse reTranscode(String mediaId) {
        ReTranscodeRequest request = new ReTranscodeRequest().withMediaId(mediaId);
        return reTranscode(request);
    }
237079
public DownloadMaterialResponse downloadMaterial(String mediaId, MaterialType type){
        DownloadMaterialResponse response = new DownloadMaterialResponse();
        String url = BASE_API_URL + "cgi-bin/material/get_material?access_token=" + config.getAccessToken();
        RequestConfig config = RequestConfig.custom().setConnectionRequestTimeout(NetWorkCenter.CONNECT_TIMEOUT).setConnectTimeout(NetWorkCenter.CONNECT_TIMEOUT).setSocketTimeout(NetWorkCenter.CONNECT_TIMEOUT).build();
        CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
        HttpPost request = new HttpPost(url);
        StringEntity mediaEntity = new StringEntity("{\"media_id\":\"" + mediaId + "\"}", ContentType.APPLICATION_JSON);
        request.setEntity(mediaEntity);

        CloseableHttpResponse httpResponse = null;
        try{
            httpResponse = client.execute(request);
            if(HttpStatus.SC_OK == httpResponse.getStatusLine().getStatusCode()){
                HttpEntity entity;
                String resultJson;
                switch (type){
                    case NEWS:
                        entity = httpResponse.getEntity();
                        resultJson = EntityUtils.toString(entity, Charset.forName("UTF-8"));
                        response = JSONUtil.toBean(resultJson, DownloadMaterialResponse.class);
                        LOG.debug("-----------------请求成功-----------------");
                        LOG.debug("响应结果:");
                        LOG.debug(resultJson);
                        if (StrUtil.isBlank(response.getErrcode())) {
                            response.setErrcode("0");
                            response.setErrmsg(resultJson);
                        }
                        break;
                    case VIDEO:
                        entity = httpResponse.getEntity();
                        resultJson = EntityUtils.toString(entity, Charset.forName("UTF-8"));
                        LOG.debug("-----------------请求成功-----------------");
                        LOG.debug("响应结果:");
                        LOG.debug(resultJson);
                        response = JSONUtil.toBean(resultJson, DownloadMaterialResponse.class);
                        if (StrUtil.isBlank(response.getErrcode())) {
                            response.setErrcode("0");
                            response.setErrmsg(resultJson);
                            // 通过down_url下载文件。文件放置在content中。通过writeTo方法获取
                            downloadVideo(response);
                        }
                        break;
                    default:
                        Header length = httpResponse.getHeaders("Content-Length")[0];
                        InputStream inputStream = httpResponse.getEntity().getContent();
                        response.setContent(inputStream, Integer.valueOf(length.getValue()));
                        break;
                }
            }else{
                response.setErrcode(String.valueOf(httpResponse.getStatusLine().getStatusCode()));
                response.setErrmsg("请求失败");
            }
        } catch (IOException e) {
            LOG.error("IO流异常", e);
        } catch (Exception e) {
            LOG.error("其他异常", e);
        }

        return response;
    }
944845
public function removeAction($mediaId)
    {
        $media = $this->getMedia($mediaId);
        $request = $this->getRequest();
        if ($request->request->get('confirm') === 'yes' || $request->get('confirm') === 'yes')
        {
            $this->get('fulgurio_light_cms.media_library')->remove($media);
            $em = $this->getDoctrine()->getManager();
            $em->remove($media);
            $em->flush();
            return $this->redirect($this->generateUrl('AdminMedias'));
        }
        else if ($request->request->get('confirm') === 'no')
        {
            return $this->redirect($this->generateUrl('AdminMedias', array('mediaId' => $mediaId)));
        }
        $templateName = $request->isXmlHttpRequest() ? 'FulgurioLightCMSBundle::adminConfirmAjax.html.twig' : 'FulgurioLightCMSBundle::adminConfirm.html.twig';
        return $this->render($templateName, array(
            'action' => $this->generateUrl('AdminMediasRemove', array('mediaId' => $mediaId)),
            'confirmationMessage' => $this->get('translator')->trans('fulgurio.lightcms.medias.delete_confirm_message', array('%FILENAME%' => $media->getOriginalName()), 'admin'),
        ));
    }
553376
private function doPermanentFetchToStream ($mediaID, $into)
    {
        $body = $this->client->send(
            new Request(
                'POST',
                'https://api.weixin.qq.com/cgi-bin/material/get_material',
                [],
                json_encode([
                    'media_id' => $mediaID,
                ])
            ),
            [
                RequestOptions::SINK => $this->createWritableStream($into),
            ]
        )->getBody();

        if ($body->isSeekable()) {
            $body->seek(0);
        }

        return $body->detach();
    }
373640
public function download($mediaId, $filename = '')
    {
        $params = array('media_id' => $mediaId, 'agentid' => $this->agentId);

        $api = $this->forever ? self::API_FOREVER_GET : self::API_TEMPORARY_GET;

        $contents = $this->http->get($api, $params);

        $filename = $filename ? $filename : $mediaId;

        if (!is_array($contents)) {
            $ext = File::getStreamExt($contents);

            file_put_contents($filename.$ext, $contents);

            return $filename.$ext;
        } else {
            return $contents;
        }
    }
437287
private UploadedMedia uploadMediaChunkedFinalize(long mediaId) throws TwitterException {
		int tries = 0;
		int maxTries = 20;
		int lastProgressPercent = 0;
		int currentProgressPercent = 0;
		UploadedMedia uploadedMedia = uploadMediaChunkedFinalize0(mediaId);
		while (tries < maxTries) {
			if(lastProgressPercent == currentProgressPercent) {
				tries++;
			}
			lastProgressPercent = currentProgressPercent;
			String state = uploadedMedia.getProcessingState();
			if (state.equals("failed")) {
				throw new TwitterException("Failed to finalize the chuncked upload.");
			}
			if (state.equals("pending") || state.equals("in_progress")) {
				currentProgressPercent = uploadedMedia.getProgressPercent();
				int waitSec = Math.max(uploadedMedia.getProcessingCheckAfterSecs(), 1);
				logger.debug("Chunked finalize, wait for:" + waitSec + " sec");
				try {
					Thread.sleep(waitSec * 1000);
				} catch (InterruptedException e) {
					throw new TwitterException("Failed to finalize the chuncked upload.", e);
				}
			}
			if (state.equals("succeeded")) {
				return uploadedMedia;
			}
			uploadedMedia = uploadMediaChunkedStatus(mediaId);
		} 
		throw new TwitterException("Failed to finalize the chuncked upload, progress has stopped, tried " + tries+1 + " times.");
	}
989849
public function postDelete($mediaId)
    {
        $media = Media::findOrFail($mediaId);
        $media->delete();

        return redirect($this->admin->currentUrl())->with('notifications_below_header', [['type' => 'success', 'icon' => 'check-circle', 'title' => 'Success!', 'message' => 'The Media was successfully deleted.', 'dismissable' => false]]);
    }
73668
def from_mediaid(cls, context: InstaloaderContext, mediaid: int):
        """"""
        return cls.from_shortcode(context, Post.mediaid_to_shortcode(mediaid))
241915
public function delete($mediaId)
    {
        return $this->http->get(self::API_FOREVER_DELETE, array('media_id' => $mediaId, 'agentid' => $this->agentId));
    }
1122740
public function fetchPermanentAudio ($mediaID, $into = null)
    {
        return new Downloaded\Audio($mediaID, $this->doPermanentFetchToStream($mediaID, $into));
    }
268096
public function getMedia($media_id){
		if (!$this->access_token && !$this->checkAuth()) return false;
		$result = $this->http_get(self::API_URL_PREFIX.self::MEDIA_GET_URL.'access_token='.$this->access_token.'&media_id='.$media_id);
		if ($result)
		{
			$json = json_decode($result,true);
			if (isset($json['errcode'])) {
				$this->errCode = $json['errcode'];
				$this->errMsg = $json['errmsg'];
				return false;
			}
			return $result;
		}
		return false;
	}
60822
public static String createEnMediaTag(Resource resource) {
        return "<en-media hash=\"" + bytesToHex(resource.getData().getBodyHash()) + "\" type=\"" + resource.getMime() + "\"/>";
    }
27823
public boolean mediaIsVideo () {
        String contentType = this.getContentType();
        return contentType != null && this.media != null && contentType.startsWith("video");
    }
733563
public function downloadMedia($mediaId)
    {
        $result = $this->_curl("https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token={$this->getAccessToken()}&media_id={$mediaId}");

        $match = [];

        preg_match_all('/\nContent-disposition: ?attachment; ?filename="([^"]*?)"/ism', $result['head'], $match);

        return [
            'filename' => $match[1][0],
            'content' => $result['body'],
        ];
    }
927077
async def download_media_by_id(self, media_id):
        
        try:
            msg = self.found_media[int(media_id)]
        except (ValueError, KeyError):
            # ValueError when parsing, KeyError when accessing dictionary
            print('Invalid media ID given or message not found!')
            return

        print('Downloading media to usermedia/...')
        os.makedirs('usermedia', exist_ok=True)
        output = await self.download_media(
            msg.media,
            file='usermedia/',
            progress_callback=self.download_progress_callback
        )
        print('Media downloaded to {}!'.format(output))
483481
public function deleteMaterial($mediaId)
    {
        $result = $this->httpRaw(self::WECHAT_MATERIAL_DELETE_PREFIX, [
            'media_id' => $mediaId
        ], [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'];
    }
1299470
def GetAttachmentIdFromMediaId(media_id):
    
    altchars = '+-'
    if not six.PY2:
        altchars = altchars.encode('utf-8')
    # altchars for '+' and '/'. We keep '+' but replace '/' with '-'
    buffer = base64.b64decode(str(media_id), altchars)
    resoure_id_length = 20
    attachment_id = ''
    if len(buffer) > resoure_id_length:
        # We are cutting off the storage index.
        attachment_id = base64.b64encode(buffer[0:resoure_id_length], altchars)
        if not six.PY2:
            attachment_id = attachment_id.decode('utf-8')
    else:
        attachment_id = media_id

    return attachment_id