Linux, shell script: Sự kết hợp giữa wget, sed, awk để download.
Dùng để download từ libgen.pw
```
#!/bin/bash
cd $(dirname $0)
LINKS="$1"
for i in $(phantomjs save_page.js "$LINKS" | grep pdf | sed 's@+@ @g;s@%@\\x@g'| xargs -0 printf "%b" | awk 'BEGIN{FS="chl="} {print $2}' | awk 'BEGIN{FS="\""} FNR==3 {print $1}' | sed 's/\ /%20/g')
do
NAMES=$(echo $i |sed "s/%20/\ /g"| awk -F'hidden0=' '{print $2}')
echo "$NAMES"
wget --header\="Referer: "$LINKS"" -O "$NAMES" "$i"
done
```
Trong đó save_page.js có nội dung như sau:
```
var system = require('system');
var page = require('webpage').create();
page.open(system.args[1], function()
{
console.log(page.content);
phantom.exit();
});
```
```
#!/bin/bash
cd $(dirname $0)
LINKS="$1"
for i in $(phantomjs save_page.js "$LINKS" | grep pdf | sed 's@+@ @g;s@%@\\x@g'| xargs -0 printf "%b" | awk 'BEGIN{FS="chl="} {print $2}' | awk 'BEGIN{FS="\""} FNR==3 {print $1}' | sed 's/\ /%20/g')
do
NAMES=$(echo $i |sed "s/%20/\ /g"| awk -F'hidden0=' '{print $2}')
echo "$NAMES"
wget --header\="Referer: "$LINKS"" -O "$NAMES" "$i"
done
```
Trong đó save_page.js có nội dung như sau:
```
var system = require('system');
var page = require('webpage').create();
page.open(system.args[1], function()
{
console.log(page.content);
phantom.exit();
});
```