Gehst du gerade davon aus, dass die IDs der Spiele des Turniers in einer sortierten Reihenfolge stehen? Das ist nämlich nicht der Fall. Die Datensätze, die hinterher da sein müssen sind folgende:
Code: Alles auswählen
guybrush@marvin:~/tmp/wget$ wget -O - -o /dev/null http://www.chess.com/tournaments/games?id=87416 | grep echess/game >urigames
guybrush@marvin:~/tmp/wget$ sed 's/^.*game?id/http:\/\/www.chess.com\/echess\/download_pgn?id/;s/"\sid.*$//' urigames >pgnuris
guybrush@marvin:~/tmp/wget$ cat pgnuris
http://www.chess.com/echess/download_pgn?id=111277688
http://www.chess.com/echess/download_pgn?id=111431196
http://www.chess.com/echess/download_pgn?id=111309034
http://www.chess.com/echess/download_pgn?id=110937568
http://www.chess.com/echess/download_pgn?id=110394418
http://www.chess.com/echess/download_pgn?id=110944492
http://www.chess.com/echess/download_pgn?id=110394412
http://www.chess.com/echess/download_pgn?id=110394416
http://www.chess.com/echess/download_pgn?id=110394410
http://www.chess.com/echess/download_pgn?id=110394420
http://www.chess.com/echess/download_pgn?id=110581478
http://www.chess.com/echess/download_pgn?id=110394414
http://www.chess.com/echess/download_pgn?id=107381428
http://www.chess.com/echess/download_pgn?id=107425384
http://www.chess.com/echess/download_pgn?id=106692820
http://www.chess.com/echess/download_pgn?id=105373804
http://www.chess.com/echess/download_pgn?id=105715604
http://www.chess.com/echess/download_pgn?id=106801266
http://www.chess.com/echess/download_pgn?id=106547162
http://www.chess.com/echess/download_pgn?id=106722810
http://www.chess.com/echess/download_pgn?id=103638896
http://www.chess.com/echess/download_pgn?id=103638908
http://www.chess.com/echess/download_pgn?id=104700154
http://www.chess.com/echess/download_pgn?id=105547778
http://www.chess.com/echess/download_pgn?id=105657602
http://www.chess.com/echess/download_pgn?id=105484020
http://www.chess.com/echess/download_pgn?id=103638926
http://www.chess.com/echess/download_pgn?id=103638924
http://www.chess.com/echess/download_pgn?id=103638900
http://www.chess.com/echess/download_pgn?id=104462788
http://www.chess.com/echess/download_pgn?id=103638902
http://www.chess.com/echess/download_pgn?id=104774206
http://www.chess.com/echess/download_pgn?id=105064160
http://www.chess.com/echess/download_pgn?id=104774158
http://www.chess.com/echess/download_pgn?id=105169112
http://www.chess.com/echess/download_pgn?id=105077282
http://www.chess.com/echess/download_pgn?id=104824738
http://www.chess.com/echess/download_pgn?id=105202986
http://www.chess.com/echess/download_pgn?id=103638934
http://www.chess.com/echess/download_pgn?id=103638922
http://www.chess.com/echess/download_pgn?id=104452912
http://www.chess.com/echess/download_pgn?id=103638936
http://www.chess.com/echess/download_pgn?id=103638938
http://www.chess.com/echess/download_pgn?id=103638914
http://www.chess.com/echess/download_pgn?id=104328814
http://www.chess.com/echess/download_pgn?id=103638942
http://www.chess.com/echess/download_pgn?id=103638916
http://www.chess.com/echess/download_pgn?id=103638910
http://www.chess.com/echess/download_pgn?id=103638894
http://www.chess.com/echess/download_pgn?id=104416208
Ansonsten habe ich, ganz ehrlich, nicht kapiert, was du da machst…
-----------------------------------------------------------------------------------------
Edit: Script für eine Seite
So weit bin ich schon einmal:
(Bitte nicht Auslachen, ist mein erstes Script!)
Code: Alles auswählen
#!/bin/bash
#
# tournget.sh
# script for downloading multiple tournament *.png from chess.com
#
echo "Script for downloading multiple tournament *.png files from chess.com"
if [ -n "$1" ]
then
wget -O - -o /dev/null http://www.chess.com/tournaments/games?id="$1" | grep echess/game >/tmp/urigames
else
echo "usage: tournget.sh GAMES_ID OUTPUT[.PGN]"
fi
if [ -f /tmp/urigames ]
then
sed 's/^.*game?id/http:\/\/www.chess.com\/echess\/download_pgn?id/;s/"\sid.*$//' /tmp/urigames >/tmp/pgnuris
else
echo "Error while reading games ID!"
fi
if [ -f /tmp/pgnuris ]
then
echo "Compiling $2.pgn. Please wait..."
wget -i /tmp/pgnuris -O - -o /dev/null | sed 's/.$//' > $2.pgn
else
echo "Error while compiling PGN file!"
fi
rm -v /tmp/urigames /tmp/pgnuris
echo "$2.pgn is ready to use! :)"
Verbesserungsvorschläge sind mir selbstverständlich sehr willkommen!
Es fehlt hier halt noch das Hinzufügen der PGNs der folgenden Seiten vom Turnier…