Re: gtik (stock ticker) broken because yahoo still change its page



This patch is really broken also (layout changed so much). forget it, ...

Rémi Cohen-Scali wrote:

Yahoo finance web still changed its look. Stock ticker is of course broken.
Here is a patch for fixing gtik.
Is it possible to commit it for 2.4?
Else gtik is not usable.

------------------------------------------------------------------------

diff -urN gnome-applets-2.3.90/gtik.old/gtik.c gnome-applets-2.3.90/gtik/gtik.c
--- gnome-applets-2.3.90/gtik.old/gtik.c	Thu Jul 24 03:48:15 2003
+++ gnome-applets-2.3.90/gtik/gtik.c	Fri Sep  5 07:10:56 2003
@@ -271,9 +271,9 @@
		stockdata->vfshandle = NULL;
	}
		
-	source_text_uri = g_strconcat("http://finance.yahoo.com/q?s=";,
+	source_text_uri = g_strconcat("http://finance.yahoo.com/q/cq?s=";,
				      stockdata->props.tik_syms,
-				      "&d=v2",
+ "&d=v1", NULL);

	source_uri = gnome_vfs_uri_new(source_text_uri);
@@ -411,7 +411,7 @@

		int  i=0;
		int  j=0;
-		static char Text[256]="";
+		static char Text[1024]="";

		if (line == NULL) {
			Text[0] = '\0';
@@ -441,10 +441,10 @@
	}

	/*-----------------------------------------------------------------*/
-	static char *parseQuote(FILE *CONFIG, char line[512]) {
+	static char *parseQuote(FILE *CONFIG, char line[1024]) {
		
-		char symbol[512];
-		char buff[512];
+		char symbol[1024];
+		char buff[1024];
		char price[16];
		char change[16];
		char percent[16];
@@ -473,16 +473,16 @@
		linenum++;

		/* Skip the time... */
-		if (!AllOneLine) fgets(line,255,CONFIG);
+		if (!AllOneLine) fgets(line,1023,CONFIG);
		else section = strtok(NULL,"|");
		linenum++;

		while (linenum < 8 ) {
			if (!AllOneLine) {
-				fgets(line,255,CONFIG);
+				fgets(line,1023,CONFIG);
			
				if (strstr(line,
-			  	 "<td align=center nowrap colspan=2>")) {
+			  	 "<td class=\"yfnc_tabledata1\" nowrap=\"nowrap\" align=\"center\">")) {
					strcpy(change,"");
					strcpy(percent,"");
					linenum=100;
@@ -491,26 +491,26 @@
			else {
				section = strtok(NULL,"|");
				if (strstr(section,
-			  	 "<td align=center nowrap colspan=2>")) {
+			  	 "<td class=\"yfnc_tabledata1\" nowrap=\"nowrap\" align=\"center\">")) {
					strcpy(change,"");
					strcpy(percent,"");
					linenum=100;
				}
			}

- if (linenum == 2) { + if (linenum == 3) { if (!AllOneLine) strcpy(price,extractText(line));
				else
					strcpy(price,extractText(section));
			}
-			else if (linenum == 3) {
+			else if (linenum == 4) {
				if (!AllOneLine)
					strcpy(change,extractText(line));
				else
					strcpy(change,extractText(section));
			}
-			else if (linenum == 4) {
+			else if (linenum == 5) {
if (!AllOneLine) strcpy(percent,extractText(line));
				else
@@ -530,7 +530,7 @@
	int configured(StockData *stockdata) {
		int retVar;

-		char  buffer[512];
+		char  buffer[2048];
		static FILE *CONFIG;

		CONFIG = fopen((const char *)stockdata->configFileName,"r");
@@ -545,7 +545,7 @@
				fgets(buffer, sizeof(buffer)-1, CONFIG);

				if (strstr(buffer,
-				    "<td nowrap align=left><font face=arial size=-1><a href=\"/q\?s=")) {
+				    "<td class=\"yfnc_tabledata1\" nowrap=\"nowrap\" align=\"center\"><b><a href=\"/q?s=")) {

				      setOutputArray(stockdata, parseQuote(CONFIG,buffer));
				      retVar = 1;




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]