import org.hedgecode.chess.scanner.Scanner;
import org.hedgecode.chess.scanner.ScannerException;
+import org.hedgecode.chess.scanner.StringUtils;
import org.hedgecode.chess.scanner.entity.PGNGame;
import org.hedgecode.chess.scanner.entity.PGNTournament;
String pgn = request(
assignUrl(gameId)
);
- if (!isPgnFormat(pgn)) {
+ if (!StringUtils.isPgn(pgn)) {
throw new ScannerException(
String.format("Failed to get PGN for requesting game ID: %s", gameId)
);
@Override
public PGNGame scanUrl(String gameUrl) throws ScannerException {
- String pgn = regex(
- request(
- gameUrl
- ),
+ String gamePage = request(gameUrl);
+ String pgn = StringUtils.match(
+ gamePage,
getSettings().getGameUrlRegex()
);
- if (pgn == null || !isPgnFormat(pgn)) {
+ if (pgn == null || !StringUtils.isPgn(pgn)) {
throw new ScannerException(
String.format("Failed to get PGN for requesting URL: %s", gameUrl)
);