Fix debug, clear data structure, add images
This commit is contained in:
parent
2a1166493f
commit
18ce1b10b8
|
@ -1,6 +1,4 @@
|
||||||
data/files/*
|
data/*
|
||||||
data/torrents/*
|
|
||||||
data/nfo/*
|
|
||||||
__pycache__/
|
__pycache__/
|
||||||
yggcrawl/__pycache__/
|
yggcrawl/__pycache__/
|
||||||
yggcrawl/__init__.pyc
|
yggcrawl/__init__.pyc
|
||||||
|
|
1
crawl.py
1
crawl.py
|
@ -29,6 +29,7 @@ from yggtorrentscraper import set_yggtorrent_tld
|
||||||
set_yggtorrent_tld("se")
|
set_yggtorrent_tld("se")
|
||||||
name = ' '.join(sys.argv[1:])
|
name = ' '.join(sys.argv[1:])
|
||||||
|
|
||||||
|
print("ok")
|
||||||
# Search torrent name
|
# Search torrent name
|
||||||
research = os.popen('./lib/scrabash.sh search --best=true ' + name).read()
|
research = os.popen('./lib/scrabash.sh search --best=true ' + name).read()
|
||||||
print(colored(research, 'yellow'))
|
print(colored(research, 'yellow'))
|
||||||
|
|
|
@ -17,37 +17,56 @@ search() {
|
||||||
[[ $best == true ]] && echo "$result" | head -n1 || echo "$result"
|
[[ $best == true ]] && echo "$result" | head -n1 || echo "$result"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_images() {
|
||||||
|
[[ -z $name ]] && echo "Please choose a torrent url" && exit 1
|
||||||
|
idTorrent=$(echo "$name" | awk -F '/' '{print $NF}' | awk -F '-' '{ print $1 }')
|
||||||
|
mkdir $idTorrent
|
||||||
|
cd $idTorrent
|
||||||
|
|
||||||
|
wget -q -r -np -nd -k "$1"
|
||||||
|
url=$(cat * | awk -v RS=' ' '/.jpg/' | awk -F '"' '{ print $2 }' | head -n1)
|
||||||
|
|
||||||
|
curl -s -O $url
|
||||||
|
}
|
||||||
|
|
||||||
get_details() {
|
get_details() {
|
||||||
result=$(./lib/py/scrapactions.py $1 $name | grep -v "Login success")
|
result=$(./lib/py/scrapactions.py $1 $name | grep -v "Login success")
|
||||||
# echo "$result"
|
# echo "$result"
|
||||||
|
|
||||||
idTorrent=$(echo "$name" | awk -F '/' '{print $NF}' | awk -F '-' '{ print $1 }')
|
idTorrent=$(echo "$name" | awk -F '/' '{print $NF}' | awk -F '-' '{ print $1 }')
|
||||||
if [[ $print == true ]]; then
|
if [[ $print == true ]]; then
|
||||||
[[ ! -d data/nfo/$idTorrent ]] && mkdir data/nfo/$idTorrent
|
[[ ! -d data/$idTorrent ]] && mkdir data/$idTorrent
|
||||||
echo "$result" > ./data/nfo/$idTorrent/info.txt
|
cd data/$idTorrent
|
||||||
|
|
||||||
|
echo "$result" > info.txt
|
||||||
|
|
||||||
torrentName=$(echo "$result" | grep -w "Name :" | awk -F ": " '{ print $2 }')
|
torrentName=$(echo "$result" | grep -w "Name :" | awk -F ": " '{ print $2 }')
|
||||||
torrentUrl=$(echo "$result" | grep -w "Url :" | awk -F ": " '{ print $2 }')
|
Url=$(echo "$result" | grep -w "Url :" | awk -F ": " '{ print $2 }')
|
||||||
torrentSize=$(echo "$result" | grep -w "Size :" | awk -F ": " '{ print $2 }')
|
Size=$(echo "$result" | grep -w "Size :" | awk -F ": " '{ print $2 }')
|
||||||
if [[ $torrentSize =~ "Go" ]]; then
|
Uploader=$(echo "$result" | grep -w "Uploader :" | awk -F ": " '{ print $2 }')
|
||||||
unity="Go"
|
Files=$(echo "$result" | grep -w "file_name :" | awk -F ": " '{ print $2 }' | wc -l)
|
||||||
|
|
||||||
|
if [[ $Size =~ "Go" ]]; then
|
||||||
|
Unity="Go"
|
||||||
else
|
else
|
||||||
unity="Mo"
|
Unity="Mo"
|
||||||
fi
|
fi
|
||||||
torrentSize=$(echo "$torrentSize" | tr -d 'Go')
|
Size=$(echo "$Size" | tr -d 'Go')
|
||||||
torrentSeeders=$(echo "$result" | grep -w "Seeders :" | awk -F ": " '{ print $2 }')
|
Seeders=$(echo "$result" | grep -w "Seeders :" | awk -F ": " '{ print $2 }')
|
||||||
|
|
||||||
echo "$idTorrent"
|
echo "$idTorrent"
|
||||||
|
|
||||||
echo "Name = '$torrentName'
|
echo -e "Name = '$torrentName'\nUrl = '$Url'\nSize = $Size\nUnity = '$Unity'\nID = $idTorrent\nUploader = $Uploader\nFiles = $Files" > db.py
|
||||||
Url = '$torrentUrl'
|
|
||||||
Size = $torrentSize
|
# Get image
|
||||||
Unity = '$unity'
|
|
||||||
Seeders = $torrentSeeders
|
[[ ! -d img ]] && mkdir img && cd img
|
||||||
ID = $idTorrent" > ./data/nfo/$idTorrent/db.py
|
url=$(wget -qO- -np -nd $name | awk -v RS=' ' '/.jpg/' | awk -F '"' '{ print $2 }' | head -n1)
|
||||||
|
curl -s -O $url
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
$1 $1
|
$1 $name
|
||||||
|
|
||||||
[[ $err == 1 ]] && exit 1 || exit 0
|
[[ $err == 1 ]] && exit 1 || exit 0
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
requests
|
||||||
|
json
|
||||||
|
sys
|
||||||
|
subprocess
|
||||||
|
login
|
||||||
|
time
|
||||||
|
re
|
||||||
|
|
|
@ -162,7 +162,6 @@ class YggTorrentScraper:
|
||||||
|
|
||||||
def search(self, parameters):
|
def search(self, parameters):
|
||||||
search_url = create_search_url(parameters)
|
search_url = create_search_url(parameters)
|
||||||
|
|
||||||
torrents_url = self.get_torrents_url(search_url, parameters)
|
torrents_url = self.get_torrents_url(search_url, parameters)
|
||||||
|
|
||||||
return torrents_url
|
return torrents_url
|
||||||
|
|
Loading…
Reference in New Issue