Spaces:
Sleeping
Sleeping
File size: 5,435 Bytes
0ea56ba | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | $targetDir = "E:\Archivos (meanwhile)"
if (!(Test-Path $targetDir)) { New-Item -ItemType Directory -Path $targetDir -Force }
$dois = @(
"10.3390/molecules25061356",
"10.3390/molecules27010014",
"10.1007/s12355-018-0589-z",
"10.3390/12030607",
"10.3390/ijms25084197",
"10.1016/j.indcrop.2016.04.054",
"10.21704/rea.v21i1.1845",
"10.3390/horticulturae11101210",
"10.3390/horticulturae11060612",
"10.1007/s11240-016-1049-7",
"10.21448/ijsm.496724",
"10.3390/biom13050746",
"10.3390/molecules25122759",
"10.1007/s12892-020-00066-1",
"10.1105/tpc.004218",
"10.21203/rs.3.rs-4835008/v1",
"10.1038/nbt.1524",
"10.36995/j.recyt.2020.33.010",
"10.1007/s10535-012-0289-6",
"10.1590/s0103-50532013005000003",
"10.1021/jf1005935",
"10.3389/fpls.2012.00222",
"10.3390/ijms252413584",
"10.1590/0103-8478cr20181029",
"10.22541/au.174394998.87153798/v1",
"10.1007/s00253-021-11306-x",
"10.1007/s11240-023-02599-z",
"10.1002/bit.25346",
"10.1038/s41598-024-65483-6",
"10.21503/cyd.v23i2.2092",
"10.1007/s11240-025-03005-6",
"10.1007/s12355-018-0655-6",
"10.1007/s11130-021-00912-9",
"10.1080/15592324.2025.2558871",
"10.3390/plants10122762",
"10.5772/50568",
"10.1007/s11240-017-1312-6",
"10.1515/biolog-2017-0133",
"10.9755/ejfa.2021.v33.i3.2666",
"10.1111/j.1365-313X.2011.04486.x",
"10.1021/jf202185m",
"10.1093/pcp/pcm131",
"10.1016/J.INDCROP.2019.111530",
"10.1007/s11240-020-01902-6",
"10.1007/s11240-024-02909-z",
"10.3390/horticulturae10080788",
"10.1007/bf02932383",
"10.5897/jmpr11.1106",
"10.1002/jbm.540010406",
"10.1016/j.bcab.2021.101907",
"10.1016/j.ejbt.2018.08.006",
"10.1007/s11738-012-1136-2",
"10.1038/330677a0",
"10.1073/pnas.89.15.7213",
"10.1007/s12355-019-00727-8",
"10.1590/s0100-84042001000300013",
"10.1111/j.1399-3054.1962.tb08052.x",
"10.3390/plants11030439",
"10.1016/b978-0-12-812689-9.00009-1",
"10.1021/acsomega.3c07404",
"10.1007/s00449-025-03270-x",
"10.17576/jsm-2022-5107-06",
"10.1007/s11240-024-02804-7",
"10.17268/agroind.sci.2020.01.13",
"10.3389/fpls.2023.1310405",
"10.1016/j.indcrop.2025.120997",
"10.15373/2249555X/nov2011/3",
"10.3389/fpls.2023.1159588",
"10.3390/antiox13060692",
"10.37761/rsqp.v87i2.343",
"10.3390/agronomy11122414",
"10.15381/rpb.v30i2.24582",
"10.18054/PB.2016.118.1.3420",
"10.5281/zenodo.2333352",
"10.3390/molecules21020182",
"10.21448/ijsm.1079812",
"10.3390/molecules25040767",
"10.17576/jsm-2025-5404-03",
"10.1155/2022/5445291",
"10.3390/molecules30173476",
"10.1201/9780138743208-2",
"10.1590/s1517-83822013005000032",
"10.3390/ijms25042136",
"10.3390/agronomy14081743",
"10.22302/iribb.jur.mp.v89i2.458",
"10.21895/incres.2015.v6n2.03",
"10.1111/j.1365-313X.2007.03082.x",
"10.17268/agroind.sci.2019.01.11",
"10.1007/s11240-024-02892-5",
"10.1109/tla.2023.10246344",
"10.1016/j.biotechadv.2021.107774",
"10.35790/eg.5.1.2017.15416",
"10.22146/mot.87736",
"10.1016/j.biotechadv.2005.01.003"
)
$mirrors = @("https://sci-hub.st", "https://sci-hub.ru", "https://sci-hub.se")
$downloaded = @()
$notDownloaded = @()
foreach ($doi in $dois) {
Write-Host "Processing $doi..." -ForegroundColor Cyan
$success = $false
foreach ($mirror in $mirrors) {
$url = "$mirror/$doi"
try {
# Use curl.exe to get the page content
$html = curl.exe -s -L -A "Mozilla/5.0" $url
# Extract PDF link using regex
if ($html -match 'id\s*=\s*"pdf"[^>]+src\s*=\s*"([^"]+)"' -or $html -match 'embed[^>]+src\s*=\s*"([^"]+)"') {
$pdfUrl = $matches[1]
if ($pdfUrl -like "//*") { $pdfUrl = "https:$pdfUrl" }
elseif ($pdfUrl -like "/*") { $pdfUrl = "$mirror$pdfUrl" }
$safeName = ($doi -replace '[^a-zA-Z0-9]', '_') + ".pdf"
$dest = Join-Path $targetDir $safeName
Write-Host " Found PDF at $pdfUrl. Downloading..." -ForegroundColor Yellow
curl.exe -L -k -A "Mozilla/5.0" -o $dest $pdfUrl
if (Test-Path $dest) {
$size = (Get-Item $dest).Length
if ($size -gt 10000) {
$success = $true
break
} else {
Write-Host " File too small ($size bytes), possibly blocked." -ForegroundColor Red
Remove-Item $dest
}
}
}
} catch {
Write-Host " Error on mirror $mirror : $_" -ForegroundColor Red
}
}
if ($success) {
$downloaded += $doi
Write-Host " SUCCESS: $doi" -ForegroundColor Green
} else {
$notDownloaded += $doi
Write-Host " FAILED: $doi" -ForegroundColor Red
}
# Random sleep to avoid detection
$sleepTime = Get-Random -Minimum 2 -Maximum 5
Start-Sleep -Seconds $sleepTime
}
# Generate Report
$reportFile = Join-Path $targetDir "informe_descarga.md"
$report = @"
# Informe de Descarga de Artículos
## Resumen
- Descargados: $($downloaded.Count)
- Fallidos/No encontrados: $($notDownloaded.Count)
## DOIs Descargados
$(foreach ($d in $downloaded) { "- $d" })
## DOIs No Descargados
$(foreach ($d in $notDownloaded) { "- $d" })
## Referencias (APA 7)
(Consulte el archivo original para las referencias completas en orden alfabético)
"@
$report | Out-File -FilePath $reportFile -Encoding utf8
Write-Host "Report generated at $reportFile" -ForegroundColor Green
|