Для Android, если вы используете OkHttp в своем проекте. Вы можете взглянуть на это. Это просто и полезно.
final HttpUrl url = HttpUrl.parse(query);
if (url != null) {
final String target = url.queryParameter("target");
final String id = url.queryParameter("id");
}
Я пробовал много вещей, но окончательное решение, с которым я пришел, выложено здесь:
Кукольник - Как я могу получить текущую страницу (application / pdf) в виде буфера или файла? [111 ]
await page.setRequestInterception(true);
page.on('request', async request => {
if (request.url().indexOf('exibirFat.do')>0) { //This condition is true only in pdf page (in my case of course)
const options = {
encoding: null,
method: request._method,
uri: request._url,
body: request._postData,
headers: request._headers
}
/* add the cookies */
const cookies = await page.cookies();
options.headers.Cookie = cookies.map(ck => ck.name + '=' + ck.value).join(';');
/* resend the request */
const response = await request_client(options);
//console.log(response); // PDF Buffer
buffer = response;
let filename = 'file.pdf';
fs.writeFileSync(filename, buffer); //Save file
} else {
request.continue();
}
});
Для этого решения необходимо: const request_client = require ('request-обещание-native');