* 旧版高清画质 * @param {string} pid - 节目ID * @returns {} -
(pid)
| 142 | * @returns {} - |
| 143 | */ |
| 144 | async function getAndroidURL720p(pid) { |
| 145 | // 获取url |
| 146 | const timestramp = Math.round(Date.now()).toString() |
| 147 | const appVersion = "2600034600" |
| 148 | const appVersionID = appVersion + "-99000-201600010010028" |
| 149 | let headers = { |
| 150 | AppVersion: `${appVersion}`, |
| 151 | TerminalId: "android", |
| 152 | "X-UP-CLIENT-CHANNEL-ID": `${appVersionID}`, |
| 153 | ClientId: client_id, |
| 154 | } |
| 155 | printDebug("client_id: " + client_id) |
| 156 | // cctv5和5+开启flv后不能回放 |
| 157 | if (pid != "641886683" && pid != "641886773") { |
| 158 | headers["appCode"] = "miguvideo_default_android" |
| 159 | } |
| 160 | // console.log(headers) |
| 161 | const str = timestramp + pid + appVersion.substring(0, 8) |
| 162 | const md5 = getStringMD5(str) |
| 163 | |
| 164 | const salt = String(Math.floor(Math.random() * 1000000)).padStart(6, '0') + '25' |
| 165 | const suffix = "2cac4f2c6c3346a5b34e085725ef7e33migu" + salt.substring(0, 4) |
| 166 | const sign = getStringMD5(md5 + suffix) |
| 167 | |
| 168 | let rateType = 3 |
| 169 | let enableHDRStr = "" |
| 170 | if (enableHDR != "false") { |
| 171 | enableHDRStr = "&4kvivid=true&2Kvivid=true&vivid=2" |
| 172 | } |
| 173 | let enableH265Str = "" |
| 174 | if (enableH265 != "false") { |
| 175 | enableH265Str = "&h265N=true" |
| 176 | } |
| 177 | // 请求 |
| 178 | const baseURL = "https://play.miguvideo.com/playurl/v1/play/playurl" |
| 179 | const params = "?sign=" + sign + "&rateType=" + rateType |
| 180 | + "&contId=" + pid + "×tamp=" + timestramp + "&salt=" + salt |
| 181 | + "&flvEnable=true&super4k=true" + enableH265Str + enableHDRStr |
| 182 | printDebug(`请求链接: ${baseURL + params}`) |
| 183 | printDebug(headers) |
| 184 | const respData = await fetchUrl(baseURL + params, { |
| 185 | headers: headers |
| 186 | }) |
| 187 | |
| 188 | printDebug(respData) |
| 189 | // console.dir(respData, { depth: null }) |
| 190 | const url = respData.body.urlInfo?.url |
| 191 | // console.log(rateType) |
| 192 | // console.log(url) |
| 193 | if (!url) { |
| 194 | return { |
| 195 | url: "", |
| 196 | rateType: 0, |
| 197 | content: respData |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | rateType = respData.body.urlInfo?.rateType |
no test coverage detected