begin process at 2012 02 11 02:06:53
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Divers

 > SOCKETS DU SITE PCINPACT.COM - AVEC VÉRIFICATIONS DES DERNIÈRES NEWS AJOUTÉES

SOCKETS DU SITE PCINPACT.COM - AVEC VÉRIFICATIONS DES DERNIÈRES NEWS AJOUTÉES


 Information sur la source

 Description

Pour les habitués de mes codes, c'est encore des sockets ... :)
Après LeMonde.fr, Clubic.com, Mcm.net, Vossey.fr, DoDnetwork.com, Athens2004.com, voilà www.pcinpact.com

le système est toujours le même, il faut taper /pcinp pour rafraichir les news (cela est fait automatiquement toutes les dix minutes pour vérifier si une nouvelle news est disponible).
Commandes :
- /pcinp view (pour voir toute la liste des 5 dernières news en entier)
- /pcinp help (pour voir toutes les commandes)
- /pcinp timer "on" ou "off" => /pcinp timer on fera activer la vérifications des nouvelles news

Format de la news donnée :
[PCInpact] [ News "PCInpact.Com" By -A-r-K-a-n-i-s- :: Heure : 14:38:52 :: News : Baladeur audio/vidéo 20Go Gmini400 d'Archos en France (39 commentaires) :: Lien : www.pcinpact.com/actu/news/Baladeur_audio_video_20 _Go_Gmini_400_dArchos.htm?vc=1 ]

Contrairement aux autre sockets que j'ai fait, il est ici impossible de faire un "say". Pour le faire, il faut remplacer le "echo -a" par "say" ou "msg #chan" sur ce début de ligne : .timer $+ %pcinp 1 %pcinp echo -a

Source

  • alias pcinp {
  • if (!$idle) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Commandes : /pcp view - /pcp timer "off" ou "on" 12::0 Script & Sockets By ArKanis 12] }
  • if (($idle) && (!%pcinp.timer)) { return }
  • if ($1 == view) { write -c pcinp.txt }
  • if ($1 == timer) {
  • if ((!$2) && ($2 != on) && ($2 != off) && (!%pcinp.timer == $null)) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Word 2 must be : on or off 12] | set %pcinp.timer off | return }
  • if ((!$2) && ($2 != on) && ($2 != off) && (%pcinp.timer != $null)) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Word 2 must be : on or off 12::0 Timer status is actually %pcinp.timer 12-0 0 = off; 1 = on 12] | set %pcinp.timer off | return }
  • if ($2 == off) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Timer is now off 12] | set %pcinp.timer 0 | return }
  • if ($2 == on) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Timer is now on 12] | set %pcinp.timer 1 | return }
  • return
  • }
  • set %pcinp 0
  • sockclose pcinp | sockopen pcinp www.pcinpact.com 80
  • }
  • on *:sockopen:pcinp:{
  • if ($sockerr) { return }
  • sockwrite -nt $sockname GET http://www.pcinpact.com/actu/archive.php?f=0&nbjour=2 HTTP/1.0
  • sockwrite -nt $sockname $crlf
  • }
  • on *:sockread:pcinp:{
  • if ($sockerr) { return }
  • sockread %a
  • if (href="/actu/news/ isin %a) { var %b = $remove(%a,<a href=",<br />,</a>) | var %b = $replace(%b," target="_blank">,$chr(32), /actu/news/,$chr(32))) | pcinp.verif %b }
  • ;tout est stocké dans le fichier pcinp.txt dans le dossier de mIRC
  • }
  • alias pcinp.verif {
  • if (!$1) { return }
  • if (%pcinp >= 5) { return }
  • tokenize 32 $1-
  • inc %pcinp
  • var %a = $1-
  • if ((commentaire isin %a) && ($right($1-,1) == $chr(41))) {
  • ;on exclue cette partie (commentaires, et Date), car autrement le script detecterai que la news ait changé à chaque nouveau commentaire
  • var %a = $+(2-,$calc($0 - 2))
  • var %a = $ [ $+ [ %a ] ]
  • }
  • if ($read(pcinp.txt,%pcinp) != %a) {
  • .timer $+ %pcinp 1 %pcinp echo -a 2[3PCInpact2] 12,1[ 0News "PCInpact.Com" By 12-14A12-14r12-15K12-0a12-15n12-14i12-14s12- ::14 H15eure0 : $1 12::14 N15ews0 : $3- 12::14 L15ien0 : $+(www.pcinpact.com/actu/news/,$2) 12]
  • write -il $+ %pcinp pcinp.txt %a
  • write -dl6 pcinp.txt
  • return
  • }
  • }
  • ;le timerpcinp est celui qui verifie qu'il n'y ait pas de nouvelles news
  • on *:connect:.timerpcinp 0 600 pcinp
  • on *:load:.timerpcinp 0 600 pcinp
  • on *:unload:.timerpcinp off
alias pcinp {
  if (!$idle) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Commandes : /pcp view - /pcp timer "off" ou "on" 12::0 Script & Sockets By ArKanis 12] }
  if (($idle) && (!%pcinp.timer)) { return }
  if ($1 == view) { write -c pcinp.txt }
  if ($1 == timer) {
    if ((!$2) && ($2 != on) && ($2 != off) && (!%pcinp.timer == $null)) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Word 2 must be : on or off 12] | set %pcinp.timer off | return }
    if ((!$2) && ($2 != on) && ($2 != off) && (%pcinp.timer != $null)) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Word 2 must be : on or off 12::0 Timer status is actually %pcinp.timer 12-0 0 = off; 1 = on 12] | set %pcinp.timer off | return }
    if ($2 == off) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Timer is now off 12] | set %pcinp.timer 0 | return }
    if ($2 == on) { echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Timer is now on 12] | set %pcinp.timer 1 | return }
    return
  }
  set %pcinp 0
  sockclose pcinp | sockopen pcinp www.pcinpact.com 80
}
on *:sockopen:pcinp:{
  if ($sockerr) { return }
  sockwrite -nt $sockname GET http://www.pcinpact.com/actu/archive.php?f=0&nbjour=2 HTTP/1.0
  sockwrite -nt $sockname $crlf
}
on *:sockread:pcinp:{
  if ($sockerr) { return }
  sockread %a
  if (href="/actu/news/ isin %a) { var %b = $remove(%a,<a href=",<br />,</a>) | var %b = $replace(%b," target="_blank">,$chr(32), /actu/news/,$chr(32))) | pcinp.verif %b }
;tout est stocké dans le fichier pcinp.txt dans le dossier de mIRC
}
alias pcinp.verif {
  if (!$1) { return }
  if (%pcinp >= 5) { return }
  tokenize 32 $1-
  inc %pcinp
  var %a = $1-
  if ((commentaire isin %a) && ($right($1-,1) == $chr(41))) {
;on exclue cette partie (commentaires, et Date), car autrement le script detecterai que la news ait changé à chaque nouveau commentaire
    var %a = $+(2-,$calc($0 - 2))
    var %a = $ [ $+ [ %a ] ]
  }
  if ($read(pcinp.txt,%pcinp) != %a) {
    .timer $+ %pcinp 1 %pcinp echo -a 2[3PCInpact2] 12,1[ 0News "PCInpact.Com" By 12-14A12-14r12-15K12-0a12-15n12-14i12-14s12- ::14 H15eure0 : $1 12::14 N15ews0 : $3- 12::14 L15ien0 : $+(www.pcinpact.com/actu/news/,$2) 12]
    write -il $+ %pcinp pcinp.txt %a
    write -dl6 pcinp.txt
    return
  }
}

;le timerpcinp est celui qui verifie qu'il n'y ait pas de nouvelles news
on *:connect:.timerpcinp 0 600 pcinp
on *:load:.timerpcinp 0 600 pcinp
on *:unload:.timerpcinp off

 Conclusion

Toutes mes sockets sont sur mon script :
http://tafroxafond.free.fr/ftp//Script%20irc%20 By%20Arkanis/Script-ArKanis.zip

J'aimerai aussi savoir si c'est saoulant d'avoir un gars qui vous colle 10 000 sockets, 1 par page ... :)
Si c'est le cas, j'en ferai plusieurs sur la même page, ca doit bien faire un bon nombre de pages déjà a mon actif ... :)


 Sources du même auteur

Source avec Zip EPGUIDES : SORTIES DES SÉRIES
Source avec Zip Source avec une capture BELOTE (MULTIJOUEURS) EN PICWIN
Source avec Zip EDITB - ALIASES FAVORIS DANS L'EDITBOX (SUGGESTION, COMPLETI...
Source avec Zip Source avec une capture METEO, DEPARTEMENTS ET ENSOLEILLEMENT MONDIAL
Source avec Zip OUTILS LINGUISTIQUE (DICTIONNAIRE, TRADUCTEUR, SYNONYMES, SI...

 Sources de la même categorie

Source avec Zip CRÉER DU MONDE SUR VOTRE SERVEUR IRC par Averell
AVOIR UNE LISTE D'UTILISATEUR EN COULEURS SELON LEURS SEXE P... par WorldDMT
COMMANDES FANTAISIES ( OP DEOP , VOICE DEVOICE ) ORIGINALES par Orona
Source avec Zip Source avec une capture CORRECTEUR par Orona
Source avec Zip Source avec une capture [DLL] DESSINER COMME LES PICWINS SUR UNE DIALOGBOX (BONUS: J... par uaip

Commentaires et avis

Commentaire de tofu le 20/08/2004 07:05:54

jle trouve vachement gros pour ce que c'est ton code, pour ce site (j'ai fais aussi un system de rappatriement des news pour ce site mais pas limité à 5)

et pour ton idée de faire un addon regroupant plusieurs sites pour avoir les news:
http://membres.lycos.fr/xdbconcept/scripting/mnews-.PNG

;)

Commentaire de Seregon le 20/08/2004 12:19:21

Essaye de changer de registre un peu
Les sockets c bien mais a force ca devien repetitif et le systeme est toujour relativement le même quand on traite l'info d'un site donc c'est pa vrmt ca qui fait progresser

Commentaire de tofu le 20/08/2004 18:25:52

surtout pour ce site ci car je sais pas si t'as vu mais il existe une page en .xml où il est grave plus simple de rechoper les infos que sur la page d'index ..

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,437 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales