Headline grabber ayuda!

  • WBO
  • Born
  • Born
  • No Avatar
  • Registrado: Sep 14, 2003
  • Mensajes: 2
  • Status: Offline

Nota Septiembre 14th, 2003, 8:06 am

Han estado tratando de obtener la siguiente secuencia de comandos para volver a trabajar. La función principal es que se agarra a los titulares de Yahoo y los muestra en su sitio.

Cualquier ayuda sería muy apreciada.

WB0
Código: [ Select ]
#!/usr/bin/perl

$end = $ENV{'QUERY_STRING'};
use LWP::Simple;

$top = qq~
<head>
<meta http-equiv=Cache-Control content=no-cache>
<meta http-equiv=Pragma content=no-cache>
<META http-equiv=PICS-Label content='(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" on "1999.07.26T09:49-0800" for "http://dailynews.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://rd.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://fullcoverage.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://news.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://vision.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://search.news.yahoo.com" r (n 0 s 0 v 0 l 0))'>
<base href=http://dailynews.yahoo.com/>
<script language=javascript>
var remote = null;
function rs(n,u,w,h){
remote = window.open(u, n, 'width=' + w + ',height=' + h +',resizable=yes,scrollbars=yes');
if (remote != null) {
if (remote.opener == null)
remote.opener = self;
window.name = 'yahooNewsRoot';
remote.location.href = u;
}
}
</script>
</head>
~;

print "Content-type: text/html\n\n";


#Yahoo Top Stories
if ($end eq "top") {

$html = get("http://dailynews.yahoo.com/");
main();
print "$top$html[0]";
}

#Yahoo Business
elsif ($end eq "bus") {

$html = get("http://dailynews.yahoo.com/h/bs/nm/?u");
business_snapshot();
main2();
print "$top$snap";
print "$html[0]";
}

#Yahoo Entertainment News
elsif ($end eq "ent") {

$html = get("http://dailynews.yahoo.com/h/en/nm/?u");
main2();
print "$top$html[0]";
}

#Yahoo Technology News
elsif ($end eq "tec") {

$html = get("http://dailynews.yahoo.com/h/tc/nm/?u");
main2();
print "$top$html[0]";
}

#Yahoo Political News
elsif ($end eq "pol") {

$html = get("http://dailynews.yahoo.com/h/pl/nm/?u");
main2();
print "$top$html[0]";
}

#Yahoo Sports News
elsif ($end eq "spo") {

$html = get("http://dailynews.yahoo.com/h/sp/ap/?u");
main2();
print "$top$html[0]";
}

#Yahoo World News
elsif ($end eq "wor") {

$html = get("http://dailynews.yahoo.com/h/wl/nm/?u");
main2();
print "$top$html[0]";
}

#Yahoo Science News
elsif ($end eq "sci") {

$html = get("http://dailynews.yahoo.com/h/sc/nm/?u");
main2();
print "$top$html[0]";
}

#Yahoo Health News
elsif ($end eq "hea") {

$html = get("http://dailynews.yahoo.com/h/hl/nm/?u");
main2();
print "$top$html[0]";
}

#Yahoo Oddly Enough
elsif ($end eq "odd") {

$html = get("http://dailynews.yahoo.com/h/od/nm/?u");
main2();
print "$top$html[0]";
}

#Yahoo Crime and Trials
elsif ($end eq "cri") {

$html = get("http://dailynews.yahoo.com/h/cr/ct/?u");
main2();
print "$top$html[0]";
}

#Yahoo Lifestyles
elsif ($end eq "lif") {

$html = get("http://dailynews.yahoo.com/h/lf/nm/?u");
main2();
print "$top$html[0]";
}

else {
print "<font color=red><center><b><h2>Please Check Your SSI Path.<h2></b></center></font>";
}

sub main{
@html = split(/<!-- _JC_ MIDDLE COLUMN -->/,$html);
@html = split(/<!-- _JC_ END MIDDLE COLUMN -->/,$html[1]);
$html[0] =~ s/\">/\" target=\_blank\">/ig;
$html[0] =~ s/bgcolor=dcdcdc/bgcolor=$table_bg/ig;
$html[0] =~ s/window\.location\.replace\(window\.location\)\;//ig;

return $html[0]
}

sub business_snapshot{
@html = split(/<!-- _JC_ MARKET SNAPSHOT -->/,$html);
@html = split(/<!-- _JC_ END MARKET SNAPSHOT -->/,$html[2]);
$html[0] =~ s/bgcolor=\"#ccccff\"/bgcolor=$table_bg/ig;
$snap = $html[0];
return $snap
}

sub main2{
@html = split(/<!-- _JC_ STORIES -->/,$html);
@html = split(/<!-- _JC_ END STORIES -->/,$html[1]);
$html[0] =~ s/.html>/.html target=\_blank>/ig;
$html[0] =~ s/<img src=..*>//ig;
return $html[0]
}
  1. #!/usr/bin/perl
  2. $end = $ENV{'QUERY_STRING'};
  3. use LWP::Simple;
  4. $top = qq~
  5. <head>
  6. <meta http-equiv=Cache-Control content=no-cache>
  7. <meta http-equiv=Pragma content=no-cache>
  8. <META http-equiv=PICS-Label content='(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" on "1999.07.26T09:49-0800" for "http://dailynews.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://rd.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://fullcoverage.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://news.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://vision.yahoo.com" r (n 0 s 0 v 0 l 0) "http://www.rsac.org/ratingsv01.html" l gen true for "http://search.news.yahoo.com" r (n 0 s 0 v 0 l 0))'>
  9. <base href=http://dailynews.yahoo.com/>
  10. <script language=javascript>
  11. var remote = null;
  12. function rs(n,u,w,h){
  13. remote = window.open(u, n, 'width=' + w + ',height=' + h +',resizable=yes,scrollbars=yes');
  14. if (remote != null) {
  15. if (remote.opener == null)
  16. remote.opener = self;
  17. window.name = 'yahooNewsRoot';
  18. remote.location.href = u;
  19. }
  20. }
  21. </script>
  22. </head>
  23. ~;
  24. print "Content-type: text/html\n\n";
  25. #Yahoo Top Stories
  26. if ($end eq "top") {
  27. $html = get("http://dailynews.yahoo.com/");
  28. main();
  29. print "$top$html[0]";
  30. }
  31. #Yahoo Business
  32. elsif ($end eq "bus") {
  33. $html = get("http://dailynews.yahoo.com/h/bs/nm/?u");
  34. business_snapshot();
  35. main2();
  36. print "$top$snap";
  37. print "$html[0]";
  38. }
  39. #Yahoo Entertainment News
  40. elsif ($end eq "ent") {
  41. $html = get("http://dailynews.yahoo.com/h/en/nm/?u");
  42. main2();
  43. print "$top$html[0]";
  44. }
  45. #Yahoo Technology News
  46. elsif ($end eq "tec") {
  47. $html = get("http://dailynews.yahoo.com/h/tc/nm/?u");
  48. main2();
  49. print "$top$html[0]";
  50. }
  51. #Yahoo Political News
  52. elsif ($end eq "pol") {
  53. $html = get("http://dailynews.yahoo.com/h/pl/nm/?u");
  54. main2();
  55. print "$top$html[0]";
  56. }
  57. #Yahoo Sports News
  58. elsif ($end eq "spo") {
  59. $html = get("http://dailynews.yahoo.com/h/sp/ap/?u");
  60. main2();
  61. print "$top$html[0]";
  62. }
  63. #Yahoo World News
  64. elsif ($end eq "wor") {
  65. $html = get("http://dailynews.yahoo.com/h/wl/nm/?u");
  66. main2();
  67. print "$top$html[0]";
  68. }
  69. #Yahoo Science News
  70. elsif ($end eq "sci") {
  71. $html = get("http://dailynews.yahoo.com/h/sc/nm/?u");
  72. main2();
  73. print "$top$html[0]";
  74. }
  75. #Yahoo Health News
  76. elsif ($end eq "hea") {
  77. $html = get("http://dailynews.yahoo.com/h/hl/nm/?u");
  78. main2();
  79. print "$top$html[0]";
  80. }
  81. #Yahoo Oddly Enough
  82. elsif ($end eq "odd") {
  83. $html = get("http://dailynews.yahoo.com/h/od/nm/?u");
  84. main2();
  85. print "$top$html[0]";
  86. }
  87. #Yahoo Crime and Trials
  88. elsif ($end eq "cri") {
  89. $html = get("http://dailynews.yahoo.com/h/cr/ct/?u");
  90. main2();
  91. print "$top$html[0]";
  92. }
  93. #Yahoo Lifestyles
  94. elsif ($end eq "lif") {
  95. $html = get("http://dailynews.yahoo.com/h/lf/nm/?u");
  96. main2();
  97. print "$top$html[0]";
  98. }
  99. else {
  100. print "<font color=red><center><b><h2>Please Check Your SSI Path.<h2></b></center></font>";
  101. }
  102. sub main{
  103. @html = split(/<!-- _JC_ MIDDLE COLUMN -->/,$html);
  104. @html = split(/<!-- _JC_ END MIDDLE COLUMN -->/,$html[1]);
  105. $html[0] =~ s/\">/\" target=\_blank\">/ig;
  106. $html[0] =~ s/bgcolor=dcdcdc/bgcolor=$table_bg/ig;
  107. $html[0] =~ s/window\.location\.replace\(window\.location\)\;//ig;
  108. return $html[0]
  109. }
  110. sub business_snapshot{
  111. @html = split(/<!-- _JC_ MARKET SNAPSHOT -->/,$html);
  112. @html = split(/<!-- _JC_ END MARKET SNAPSHOT -->/,$html[2]);
  113. $html[0] =~ s/bgcolor=\"#ccccff\"/bgcolor=$table_bg/ig;
  114. $snap = $html[0];
  115. return $snap
  116. }
  117. sub main2{
  118. @html = split(/<!-- _JC_ STORIES -->/,$html);
  119. @html = split(/<!-- _JC_ END STORIES -->/,$html[1]);
  120. $html[0] =~ s/.html>/.html target=\_blank>/ig;
  121. $html[0] =~ s/<img src=..*>//ig;
  122. return $html[0]
  123. }
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Septiembre 14th, 2003, 8:06 am

  • b_heyer
  • Web Master
  • Web Master
  • Avatar de Usuario
  • Registrado: Jun 15, 2003
  • Mensajes: 4583
  • Loc: Maryland
  • Status: Offline

Nota Septiembre 15th, 2003, 5:15 pm

y ¿Cuál es el problema?
Pixel Acres V2
  • WBO
  • Born
  • Born
  • No Avatar
  • Registrado: Sep 14, 2003
  • Mensajes: 2
  • Status: Offline

Nota Septiembre 16th, 2003, 6:14 am

b_heyer escribió:
y ¿Cuál es el problema?


El guión trabajado mucho, pero ya no coge los titulares.

Devuelve sólo la cabeza y nada más (una pantalla en blanco).

Cualquier asesoramiento para conseguir este nuevo trabajo se aprecia.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • Avatar de Usuario
  • Registrado: Dic 20, 2002
  • Mensajes: 8926
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Nota Septiembre 16th, 2003, 3:47 pm

Apuesto a que la razón no funciona es porque ya no su dailynews.yahoo.com, que URL redirecciona a algo como esto ahora:

http://story.news.yahoo.com/news?tmpl=index&cid=579

por lo que creo que necesita para ajustar la URL que va a lo que no es reorientar, y que podría resolver su problema. Si esto no funciona entonces el formato de las páginas podría haber cambiado lo suficiente en que su script no sabe cómo analizar la página más, es decir, gran parte de su script podría tener que ser reescrito. Su escritura no es tan grande aunque, por lo que si sé PERL no debería ser demasiado difícil. Si no sabe PERL recomiendo a encontrar el lugar que recibió el guión y ver si tienen una actualización.
Ozzu Hosting - Want your website on a fast server like Ozzu?

Publicar Información

  • Total de mensajes en este tema: 4 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 122 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC