summaryrefslogtreecommitdiff
path: root/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm')
-rw-r--r--lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm512
1 files changed, 285 insertions, 227 deletions
diff --git a/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm b/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm
index 560a582..52d0e59 100644
--- a/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm
+++ b/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm
@@ -2,7 +2,7 @@ package GCPlugins::GCgames::GCJeuxVideoCom;
###################################################
#
-# Copyright 2005-2010 Tian
+# Copyright 2005-2016 Tian
#
# This file is part of GCstar.
#
@@ -32,57 +32,159 @@ use GCPlugins::GCgames::GCgamesCommon;
use base 'GCPlugins::GCgames::GCgamesPluginsBase';
+ sub decryptUrl
+ {
+ my ($self, $src) = @_;
+ my $n = '0A12B34C56D78E9F';
+ my $res = 'http://www.jeuxvideo.com';
+ my $s = reverse $src;
+ my ($c, $l);
+ while (length $s)
+ {
+ $l = index $n, chop $s;
+ $c = index $n, chop $s;
+ my $car = $l * 16 + $c;
+ $res .= chr $car;
+ }
+ return $res;
+ }
+
+ sub getPlatformName
+ {
+ my ($self, $platform) = @_;
+ $platform =~ s/^360$/Xbox 360/;
+ $platform =~ s/^32X$/Mega Drive 32X/;
+ $platform =~ s/^3DS$/Nintendo 3DS/;
+ $platform =~ s/^C64$/Commodore 64/;
+ $platform =~ s/^CPC$/Amstrad CPC/;
+ $platform =~ s/^DCAST$/Dreamcast/;
+ $platform =~ s/^DS$/Nintendo DS/;
+ $platform =~ s/^G.GEAR$/Game Gear/;
+ $platform =~ s/^GB$/Game Boy/;
+ $platform =~ s/^GBA$/Game Boy Advance/;
+ $platform =~ s/^Giz$/Gizmondo/;
+ $platform =~ s/^MD$/Mega Drive/;
+ $platform =~ s/^MS$/Master System/;
+ $platform =~ s/^N64$/Nintendo 64/;
+ $platform =~ s/^NEO$/Neo Geo/;
+ $platform =~ s/^New 3DS$/New Nintendo 3DS/;
+ $platform =~ s/^NGAGE$/N-Gage/;
+ $platform =~ s/^NGC$/Gamecube/;
+ $platform =~ s/^ONE$/Xbox One/;
+ $platform =~ s/^PC ENG$/PC Engine/;
+ $platform =~ s/^PS1$/PlayStation/;
+ $platform =~ s/^PS2$/PlayStation 2/;
+ $platform =~ s/^PS3$/PlayStation 3/;
+ $platform =~ s/^PS4$/PlayStation 4/;
+ $platform =~ s/^SNES$/Super Nintendo/;
+ $platform =~ s/^ST$/Atari ST/;
+ $platform =~ s/^V.BOY$/Virtual Boy/;
+ $platform =~ s/^Vita$/PS Vita/;
+ $platform =~ s/^WiiU$/Wii U/;
+ return $platform;
+ }
+
+ sub loadMultipleResults
+ {
+ my ($self, $url) = @_;
+ my $page = $self->loadPage($url); $page =~ /<div\s+class="game-top-version-dispo">(.*?)<\/div>/s;
+ my $tabs = $1;
+ $page =~ /<strong>Sortie\s+France\s+:\s+<\/strong>(.*)/i;
+ my $released = $1;
+ $page =~ /<h1\s+class="highlight">(.*?)<\/h1>/i;
+ my $name = $1;
+ $name =~ s/&#039;/'/g;
+ $name =~ s/&amp;/&/g;
+ my @lines = split /\n/, $tabs;
+ foreach my $line (@lines)
+ {
+ if ($line =~ /href="([^"]*)".*?>([0-9a-zA-Z_. -]*)<\/a>/)
+ {
+ my $url = $1;
+ my $platform = $self->getPlatformName($2);
+ $self->{itemIdx}++;
+ $self->{itemsList}[$self->{itemIdx}]->{url} = 'http://www.jeuxvideo.com'.$url;
+ $self->{itemsList}[$self->{itemIdx}]->{name} = $name;
+ $self->{itemsList}[$self->{itemIdx}]->{platform} = $platform;
+ $self->{itemsList}[$self->{itemIdx}]->{released} = $released;
+ }
+ elsif ($line =~ /<span class="label-support active-mach-version label-.*" itemprop="device" content=".*">([0-9a-zA-Z_. -]*)<\/span>/)
+ {
+ # for some reason, it ends with a / but it's not a multi-platform game
+ $self->{itemIdx}++;
+ $name =~ s/ sur $1$//e;
+ $self->{itemsList}[$self->{itemIdx}]->{url} = $url;
+ $self->{itemsList}[$self->{itemIdx}]->{name} = $name;
+ $self->{itemsList}[$self->{itemIdx}]->{platform} = $self->getPlatformName($1);
+ $self->{itemsList}[$self->{itemIdx}]->{released} = $released;
+ }
+ }
+ }
+
sub start
{
my ($self, $tagname, $attr, $attrseq, $origtext) = @_;
$self->{inside}->{$tagname}++;
- return if $self->{parsingEnded};
if ($self->{parsingList})
{
- if (($tagname eq 'div') && (($attr->{id} eq 'new_mc') || ($attr->{id} eq 'old_mc')))
+ if ($tagname eq 'span')
{
- $self->{inResults} = 1;
- }
- elsif ($self->{inResults})
- {
- if ($tagname eq 'img')
+ if (($attr->{class} =~ /JvCare\s+([0-9A-F]*)\s+lien-jv/) && ($attr->{title} ne ""))
{
- $self->{currentPlatform} = $attr->{alt};
+ my $url = $self->decryptUrl($1);
+ if (! exists $self->{urls}->{$url})
+ {
+ if ($url =~ /\/$/)
+ {
+ #If it ends with a /, it means it's a multi-platform game, and the link points to a common page
+ $self->loadMultipleResults($url);
+ $self->{urls}->{$url} = 1;
+ }
+ else
+ {
+ $self->{itemIdx}++;
+ $self->{itemsList}[$self->{itemIdx}]->{url} = $url;
+ $self->{isGame} = 1;
+ # Note : some game's name contains '-' => not use $attr->{title}
+ $self->{isName} = 1;
+
+ my @array = split(/-/,$attr->{title});
+ if (scalar(@array) ge 3 )
+ {
+ if (!($array[$#array] =~ /date/i))
+ {
+ $self->{itemsList}[$self->{itemIdx}]->{released} = $array[$#array];
+ }
+ }
+
+ $self->{urls}->{$url} = 1;
+ }
+ }
}
- elsif (($tagname eq 'a') && ($attr->{href} =~ /^http/))
+ return if !$self->{isGame};
+ if ($attr->{class} =~ /recherche-aphabetique-item-machine/)
{
- $self->{itemIdx}++;
- $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href};
- $self->{itemsList}[$self->{itemIdx}]->{platform} = $self->{currentPlatform};
- $self->{isGame} = 1;
+ $self->{isPlatform} = 1;
}
}
}
elsif ($self->{parsingTips})
{
- if ($tagname eq 'tpfdebuttpf')
+ if ($attr->{class} eq 'rubrique-asl')
{
$self->{isTip} = 1;
}
- elsif ( ($tagname eq 'h3') && ($attr->{class} eq 'titre_bloc') && ($self->{isTip} ne 4))
- {
- $self->{isTip} = 2;
- }
- elsif ( (($tagname eq 'h3') || ($tagname eq 'h4') || ($tagname eq 'h5') ) && ($self->{isTip} ne 3) && ($self->{isTip} ne 4))
- {
- $self->{isTip} = 2;
- }
- elsif ( ($tagname eq 'p') && ($self->{isTip} ne 3) && ($self->{isTip} ne 4))
+ elsif (($tagname eq 'tpfdebuttpf') && ($self->{isTip} eq 2))
{
- $self->{isTip} = 1;
+ $self->{isTip} = 3;
}
- elsif ($tagname eq 'tpfstopsolution')
+ elsif ( (($tagname eq 'p') || ($tagname eq 'h2') || ($tagname eq 'h3')) && (($self->{isTip} eq 3) || ($self->{isTip} eq 4)) )
{
- $self->{isTip} = 4;
+ $self->{curInfo}->{secrets} .= "\n" if $self->{curInfo}->{secrets};
}
- elsif ($tagname eq 'tpffintpf')
+ elsif (($tagname eq 'tpffintpf') && ($self->{isTip} ne 0))
{
- $self->{isTip} = 3;
+ $self->{isTip} = 2;
}
elsif ($tagname eq 'head')
{
@@ -93,71 +195,78 @@ use GCPlugins::GCgames::GCgamesCommon;
}
else
{
- if (($tagname eq 'meta') && ($attr->{property} eq 'og:image'))
+ if ($tagname eq 'span')
{
- my $cover = $attr->{content};
- $cover =~ s|(http://[^/]*)/([^i])|$1/images/$2|;
- if ($self->{bigPics})
+ if ($attr->{class} =~ 'label-support active')
{
- $cover =~ s/-p(-|\.)/-g$1/;
- $cover =~ s/t(\.jpg)/$1/;
+ $self->{is} = 'platform';
}
- my $back = $cover;
- if (!($back =~ s/-avant(-|\.)/-arriere$1/))
+ elsif ($attr->{itemprop} eq 'description')
{
- $back =~ s/f(t?\.jpg)/r$1/;
+ $self->{is} = 'description';
}
- $self->{curInfo}->{boxpic} = $cover;
- $self->{curInfo}->{backpic} = $back;
- }
- elsif (($tagname eq 'li') && ($attr->{class} eq 'note_redac'))
- {
- $self->{is} = 'ratingpress';
- }
- elsif ( ($tagname eq 'div') && ($attr->{class} eq 'series_images') )
- {
- $self->{inScreenshots} = 1;
- }
- elsif ( ($tagname eq 'img') && ($self->{inScreenshots}) )
- {
- if (! $self->{curInfo}->{screenshot1})
+ elsif ($attr->{itemprop} eq 'genre')
+ {
+ $self->{is} = 'genre';
+ }
+ elsif ($attr->{class} eq 'recto-jaquette actif')
{
- $self->{curInfo}->{screenshot1} = $attr->{src};
- $self->{curInfo}->{screenshot1} =~ s/.gif/.jpg/;
- $self->{curInfo}->{screenshot1} =~ s/_m\.jpg/\.jpg/;
+ $self->{is} = 'boxpic';
}
- elsif (! $self->{curInfo}->{screenshot2})
+ elsif ($attr->{class} eq 'verso-jaquette actif')
{
- $self->{curInfo}->{screenshot2} = $attr->{src};
- $self->{curInfo}->{screenshot2} =~ s/.gif/.jpg/;
- $self->{curInfo}->{screenshot2} =~ s/_m\.jpg/\.jpg/;
- $self->{isScreen} = 0;
+ $self->{is} = 'backpic';
+ }
+ elsif (($attr->{'data-modal'} eq 'image') && $self->{is})
+ {
+ $self->{curInfo}->{$self->{is}} = 'http:'.$attr->{'data-selector'};
+ $self->{is} = '';
}
}
- elsif (($attr->{href} =~ m^/(etajvhtm|cheats)/^) && ! ($self->{urlTips}))
+ elsif ($tagname eq 'div')
{
- $self->{urlTips} = $attr->{href};
+ if ($attr->{class} eq 'game-top-title')
+ {
+ $self->{is} = 'name';
+ }
+ elsif ($attr->{class} eq 'bloc-note-redac')
+ {
+ $self->{is} = 'ratingpress';
+ }
+ elsif ($attr->{class} eq 'bloc-img-fiche')
+ {
+ $self->{is} = 'screenshot1';
+ }
+ elsif ($attr->{class} eq 'bloc-all-support')
+ {
+ $self->{curInfo}->{exclusive} = 0;
+ }
}
- elsif (($attr->{href} =~ m/test.htm/) && ! ($self->{curInfo}->{players}))
+ elsif ($tagname eq 'img')
{
- my $html = $self->loadPage($attr->{href});
-
- my $found = index($html,"<li><strong>Multijoueurs :</strong>");
- if ( $found >= 0 )
+ if ($self->{is} =~ /screenshot/)
{
- $html = substr($html, $found +length('<li><strong>Multijoueurs :</strong>'),length($html)- $found -length('<li><strong>Multijoueurs :</strong>'));
- $self->{curInfo}->{players} = substr($html, 0, index($html, "<"));
-
- # Enleve les blancs en debut de chaine
- $self->{curInfo}->{players} =~ s/^\s+//;
- # Enleve les blancs en fin de chaine
- $self->{curInfo}->{players} =~ s/\s+$//;
-
- $self->{curInfo}->{players} =~ s/-/1/;
- $self->{curInfo}->{players} =~ s/non/1/i;
- $self->{curInfo}->{players} =~ s/oui/Multijoueurs/i;
+ (my $src = 'http:'.$attr->{'data-srcset'}) =~ s/medias-sm/medias/;
+ $self->{curInfo}->{$self->{is}} = $src;
+ if ($self->{is} eq 'screenshot1')
+ {
+ $self->{is} = 'screenshot2';
+ }
+ else
+ {
+ $self->{is} = '';
+ }
}
}
+ elsif (($tagname eq 'h2') && ($attr->{class} =~ /titre-bloc/))
+ {
+ $self->{isTip} = 1;
+ }
+ elsif (($self->{isTip} eq 2) && ($attr->{href} =~ /wiki/i))
+ {
+ $self->{urlTips} = "http://www.jeuxvideo.com/" . $attr->{href};
+ $self->{isTip} = 0;
+ }
}
}
@@ -166,27 +275,33 @@ use GCPlugins::GCgames::GCgamesCommon;
my ($self, $tagname) = @_;
$self->{inside}->{$tagname}--;
- return if $self->{parsingEnded};
- if ($self->{parsingList})
- {
- if ($tagname eq 'div')
- {
- $self->{inResults} = 0;
- }
- }
}
sub text
{
my ($self, $origtext) = @_;
- return if $self->{parsingEnded};
if ($self->{parsingList})
{
- if ($self->{isGame})
+ return if !$self->{isGame};
+ if ($self->{isPlatform})
{
+ if ($self->{itemsList}[$self->{itemIdx}]->{platform} eq "" )
+ {
+ # Enleve le " - " présent en début de chaîne
+ $origtext =~ s/- //;
+ $self->{itemsList}[$self->{itemIdx}]->{platform} = $self->getPlatformName($origtext);
+ }
+ $self->{isPlatform} = 0;
+ }
+ elsif ($self->{isName})
+ {
+ # Enleve les blancs en debut de chaine
+ $origtext =~ s/^\s+//;
+ # Enleve les blancs en fin de chaine
+ $origtext =~ s/\s+$//;
$self->{itemsList}[$self->{itemIdx}]->{name} = $origtext;
- $self->{isGame} = 0;
+ $self->{isName} = 0;
}
}
elsif ($self->{parsingTips})
@@ -194,71 +309,86 @@ use GCPlugins::GCgames::GCgamesCommon;
# Enleve les blancs en debut de chaine
$origtext =~ s/^\s+//;
# Enleve les blancs en fin de chaine
- $origtext =~ s/\s+$//;
- if ($self->{isTip} eq 2)
+# $origtext =~ s/\s+$//;
+# There are problems with some texts if ended blanks are removed
+ if ($self->{isTip} eq 1)
+ {
+ $origtext =~ s|Gameboy|Game Boy|gi;
+ $origtext =~ s|Megadrive|Mega Drive|gi;
+ $origtext =~ s|PlayStation Portable|PSP|gi;
+ $origtext =~ s|PlayStation Vita|PS Vita|gi;
+
+ if (($origtext =~ /$self->{curInfo}->{platform}/i) || ($origtext =~ /astuce/i) || ($origtext =~ /renseignement/i) || ($origtext =~ /campagne/i))
+ {
+ $self->{isTip} = 2;
+ }
+ else
+ {
+ $self->{isTip} = 0;
+ }
+ }
+ elsif ($self->{isTip} eq 4)
{
- $self->{curInfo}->{secrets} .= "\n\n" if $self->{curInfo}->{secrets};
$self->{curInfo}->{secrets} .= $origtext;
- $self->{isTip} = 0;
}
- elsif ($self->{isTip} eq 1)
+ elsif ($self->{isTip} eq 3)
{
chomp($origtext);
if ( ($self->{curInfo}->{secrets}) && ($origtext ne "") )
{
- $self->{curInfo}->{secrets} .= "\n"
+ $self->{curInfo}->{secrets} .= "\n\n"
}
$self->{curInfo}->{secrets} .= $origtext;
- $self->{isTip} = 0;
+ $self->{isTip} = 4;
}
}
else
{
- if ($self->{inside}->{h1})
+ $origtext =~ s/^\s*//;
+ if ($self->{is} && $origtext)
{
- if ($self->{inside}->{a})
+ if ($self->{is} eq 'genre')
{
- $self->{curInfo}->{name} = $origtext;
- $self->{curInfo}->{exclusive} = 1;
+ $self->{curInfo}->{$self->{is}} .= "$origtext,";
}
- elsif ($self->{inside}->{span})
+ else
{
- if ($origtext !~ /^Fiche /)
- {
- $origtext =~ s/^\s*-?\s*//;
- $self->{curInfo}->{platform} = $origtext;
- }
+ $self->{curInfo}->{$self->{is}} = $origtext;
}
+ $self->{curInfo}->{$self->{is}} =~ s/Non/1/i if $self->{is} eq 'players';
+ $self->{curInfo}->{$self->{is}} = int($self->{curInfo}->{$self->{is}} / 2) if $self->{is} eq 'ratingpress';
+ $self->{curInfo}->{$self->{is}} =~ s/\s+$// if $self->{is} eq 'released';
+ $self->{curInfo}->{$self->{is}} = $self->getPlatformName($self->{curInfo}->{$self->{is}}) if $self->{is} eq 'platform';
+ $self->{is} = '';
}
- elsif ($self->{inside}->{strong})
- {
- $self->{is} = 'released' if ($origtext =~ /Sortie :/) || ($origtext =~ /Sortie France :/);
- $self->{is} = 'genre' if $origtext =~ /Type :/;
- $self->{is} = 'description' if $origtext =~ /Descriptif :/;
- $self->{is} = 'editor' if $origtext =~ /Editeur :/;
- $self->{is} = 'developer' if $origtext =~ /D.*?veloppeur :/;
- $self->{is} = 'players' if $origtext =~ /Multijoueurs :/;
- $self->{curInfo}->{exclusive} = 0 if $origtext =~ /Existe aussi sur :/;
- }
- elsif ($self->{is})
+ else
{
- $origtext =~ s/^\s*//;
- $origtext =~ s/\n$//;
- if ($origtext)
+ if ($self->{isTip} eq 1)
{
- if ($self->{is} eq 'players')
- {
- $origtext =~ s/-/1/;
- $origtext =~ s/non/1/i;
- $origtext =~ s/oui/Multijoueurs/i;
- }
- if ($self->{is} eq 'ratingpress')
- {
- $origtext =~ m|(\d*)/20|;
- $origtext = int($1 / 2);
- }
- $self->{curInfo}->{$self->{is}} = $origtext;
- $self->{is} = '';
+ if (($origtext =~ /wiki/i) || ($origtext =~ /etajv/i))
+ {
+ $self->{isTip} = 2;
+ }
+ else
+ {
+ $self->{isTip} = 0;
+ }
+ }
+ elsif ($origtext eq 'Editeur(s) / Développeur(s) : ')
+ {
+ $self->{is} = 'editor';
+ }
+ elsif ($origtext =~ /^\s*\|\s*$/)
+ {
+ $self->{is} = 'developer' if ! $self->{curInfo}->{developer};
+ }
+ elsif ($origtext eq 'Sortie France : ')
+ {
+ $self->{is} = 'released';
+ }
+ elsif ($origtext eq 'Nombre maximum de joueurs : ')
+ {
+ $self->{is} = 'players';
}
}
}
@@ -279,7 +409,8 @@ use GCPlugins::GCgames::GCgamesCommon;
$self->{hasField} = {
name => 1,
- platform => 1
+ platform => 1,
+ released => 1
};
$self->{isTip} = 0;
@@ -293,49 +424,24 @@ use GCPlugins::GCgames::GCgamesCommon;
my ($self, $html) = @_;
if ($self->{parsingList})
{
- $self->{parsingEnded} = 0;
- $self->{inResults} = 0;
$self->{isGame} = 0;
+ $self->{isName} = 0;
+ $self->{isReleased} = 0;
+ $self->{isPlatform} = 0;
+ $self->{urls} = {};
+ $html =~ s/<\/?b>//ge;
}
elsif ($self->{parsingTips})
{
- $html =~ s|<h4 class="lien_base"><a href="(.+)">Les astuces d|$self->RecupTips($1)|ge;
- $html =~ s|<h4 class="lien_base"><a href="(.+)">La solution d|$self->RecupSolution($1)|ge;
- $html =~ s|<h5><a href="(.+)">||gi;
- $html =~ s|<h3 class="titre_bloc"><span>Plus d'infos</span></h3>|<tpfstopsolution>|gi;
- $html =~ s|<div id="boxes_v">|<tpffintpf>|gi;
- $html =~ s|<p class="lien_base">|<tpffintpf>|gi;
- $html =~ s|<div class="player_article">|<tpffintpf>|gi;
- $html =~ s|</object>|<tpfdebuttpf>|gi;
- $html =~ s|<p class="title_bar">|<tpffintpf>|gi;
- $html =~ s|<div class="bloc3" id="astuces_ajout"><h3 class="titre_bloc">|<tpffintpf>|gi;
- $html =~ s|<br />|<p>|gi;
- $html =~ s|<kbd>|<p>|gi;
- $html =~ s|</kbd>||gi;
- $html =~ s|<b>||gi;
- $html =~ s|</b>||gi;
- $html =~ s|<span>||gi;
- $html =~ s|<img src="../pics/psx/cercle.gif"\s*(alt="CERCLE")?\s*/>|Cercle|gi;
- $html =~ s|<img src="../pics/psx/croix.gif"\s*(alt="CROIX")?\s*/>|Croix|gi;
- $html =~ s|<img src="../pics/psx/carre.gif"\s*(alt="CARRE")?\s*/>|Carr.|gi;
- $html =~ s|<img src="../pics/psx/triangle.gif"\s*(alt="TRIANGLE")?\s*/>|Triangle|gi;
- $html =~ s|<img src="http://image.jeuxvideo.com/pics/btajv/psx/cercle.gif"\s*(alt="CERCLE")?\s*/>|Cercle|gi;
- $html =~ s|<img src="http://image.jeuxvideo.com/pics/btajv/psx/croix.gif"\s*(alt="CROIX")?\s*/>|Croix|gi;
- $html =~ s|<img src="http://image.jeuxvideo.com/pics/btajv/psx/carre.gif"\s*(alt="CARRE")?\s*/>|Carr.|gi;
- $html =~ s|<img src="http://image.jeuxvideo.com/pics/btajv/psx/triangle.gif"\s*(alt="TRIANGLE")?\s*/>|Triangle|gi;
- $html =~ s|\x{92}|'|gi;
- $html =~ s|&#146;|'|gi;
- $html =~ s|&#149;|*|gi;
- $html =~ s|&#156;|oe|gi;
- $html =~ s|&#133;|...|gi;
- $html =~ s|\x{85}|...|gi;
- $html =~ s|\x{8C}|OE|gi;
- $html =~ s|\x{9C}|oe|gi;
+ $html =~ s|<a data-jvcode="HTMLBLOCK" href="(.+)">|$self->RecupTips("http://www.jeuxvideo.com" . $1)|ge;
+ $html =~ s|Chargement du lecteur vid(.)o...|<p>"Une video est disponible"</p>|gi;
+ $html =~ s|Partager sur :||gi;
+ $html =~ s|<img src="//www.jeuxvideo.com/img/keys/(.+?).gif" alt="(.+?)" />|$2|gi;
}
else
{
$self->{is} = '';
- $self->{inScreenshots} = 0;
+ $self->{curInfo}->{exclusive} = 1;
}
return $html;
}
@@ -345,74 +451,32 @@ use GCPlugins::GCgames::GCgamesCommon;
my ($self, $url) = @_;
my $html = $self->loadPage($url);
- my $savenexturl = '';
-
- my $found = index($html,"<p class=\"astuces_suiv\"> <a href=\"");
- if ( $found >= 0 )
- {
- $savenexturl = substr($html, $found +length('<p class="astuces_suiv"> <a href="'),length($html)- $found -length('<p class="astuces_suiv"> <a href="'));
- $savenexturl = substr($savenexturl, 0, index($savenexturl, "\""));
- }
-
- $found = index($html,"<div id=\"astuce_detail\" class=\"astuce\">");
- if ( $found >= 0 )
- {
- $html = substr($html, $found +length('<div id="astuce_detail" class="astuce">'),length($html)- $found -length('<div id="astuce_detail" class="astuce">'));
- $html = substr($html, 0, index($html, "<div id=\"barre_outils_v2\">"));
- if ( $savenexturl ne "" )
- {
- $html .= $self->RecupTips($savenexturl);
- }
- }
- else
- {
- $html = '';
- }
- return "<tpfdebuttpf>" . $html . "<tpffintpf>";
- }
-
- sub RecupSolution
- {
- my ($self, $url) = @_;
-
- my $html = $self->loadPage($url);
- my $savenexturl = '';
- my $found = index($html,"<p class=\"astuces_suiv\"><a href=\"");
+ my $found = index($html,"<h2 class=\"titre-bloc\">");
if ( $found >= 0 )
{
- $savenexturl = substr($html, $found +length('<p class="astuces_suiv"><a href="'),length($html)- $found -length('<p class="astuces_suiv"><a href="'));
- $savenexturl = substr($savenexturl, 0, index($savenexturl, "\""));
+ $html = substr($html, $found +length('<h2 class="titre-bloc">'),length($html)- $found -length('<h2 class="titre-bloc">'));
+ $found = index($html,"<div class=\"bloc-lien-revision\">");
+ if ( $found >= 0 )
+ {
+ $html = substr($html, 0, $found);
+ }
}
- $found = index($html,"<div id=\"astuce_detail\" class=\"soluce\">");
- if ( $found >= 0 )
- {
- $html = substr($html, $found +length('<div id="astuce_detail" class="soluce">'),length($html)- $found -length('<div id="astuce_detail" class="soluce">'));
- $html = substr($html, 0, index($html, "<div id=\"barre_outils_v2\">"));
- if ( $savenexturl ne "" )
- {
- $html .= $self->RecupSolution($savenexturl);
- }
- }
- else
- {
- $html = '';
- }
return "<tpfdebuttpf>" . $html . "<tpffintpf>";
}
-
+
sub getSearchUrl
{
my ($self, $word) = @_;
$word =~ s/\+/ /g;
- return 'http://www.jeuxvideo.com/recherche/jeux/'.$word.'.htm';
+ return 'http://www.jeuxvideo.com/recherche.php?q='.$word.'&m=9';
}
sub getItemUrl
{
my ($self, $url) = @_;
-
+
return $url if $url;
return 'http://www.jeuxvideo.com/';
}
@@ -432,12 +496,6 @@ use GCPlugins::GCgames::GCgamesCommon;
return 'FR';
}
- sub getCharset
- {
- my $self = shift;
-
- return "ISO-8859-1";
- }
sub isPreferred
{
return 1;