mirror of
https://github.com/catdevnull/transicion-desordenada-diablo
synced 2024-11-15 02:21:39 +00:00
spoof useragent en sharepoint
This commit is contained in:
parent
54f7ae086a
commit
3327fb53c7
2 changed files with 9 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,4 +2,4 @@ node_modules/
|
||||||
dataJsons/
|
dataJsons/
|
||||||
log
|
log
|
||||||
prueba
|
prueba
|
||||||
datos.gob.ar/
|
datos.gob.ar*
|
|
@ -136,8 +136,16 @@ async function downloadDistWithRetries(job, tries = 0) {
|
||||||
async function downloadDist({ dist, dataset }) {
|
async function downloadDist({ dist, dataset }) {
|
||||||
const url = new URL(dist.downloadURL);
|
const url = new URL(dist.downloadURL);
|
||||||
|
|
||||||
|
// sharepoint no le gusta compartir a bots lol
|
||||||
|
const spoofUserAgent = url.host.endsWith("sharepoint.com");
|
||||||
|
|
||||||
const res = await request(url.toString(), {
|
const res = await request(url.toString(), {
|
||||||
maxRedirections: 20,
|
maxRedirections: 20,
|
||||||
|
headers: {
|
||||||
|
"User-Agent": spoofUserAgent
|
||||||
|
? "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0"
|
||||||
|
: "transicion-desordenada (https://nulo.ar)",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
if (res.statusCode >= 300 && res.statusCode <= 399)
|
if (res.statusCode >= 300 && res.statusCode <= 399)
|
||||||
throw new TooManyRedirectsError();
|
throw new TooManyRedirectsError();
|
||||||
|
|
Loading…
Reference in a new issue