This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[Solved] m00nie eggdrop URL title grabbing script

Support & discussion of released scripts, and announcements of new releases.
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

[Solved] m00nie eggdrop URL title grabbing script

Post by m4s »

Hi all,

I've been using this script for a long time. Works well with youtube links.

Nowadays I started to look for a script which gives back the title of every other webpage (http and https), but none of them worked for me.

I would like to ask someone (especially m00nie :) ) to make this modification on the youtube script. We would get a full url grabber script.

The script can be grabbed from here:
https://www.m00nie.com/youtube-eggdrop- ... ng-api-v3/
Last edited by m4s on Thu Mar 25, 2021 2:12 pm, edited 2 times in total.
m
m00nie
Voice
Posts: 14
Joined: Sat Mar 28, 2020 2:02 pm

Post by m00nie »

Hi m4s :D

I gave this a go here https://m00nie.com/eggdrop-url-title-grabbing-script/ although it's not part of the YouTube script just yet. I might mangle it together with the YouTube and Twitter scripts though in the future if this one seems to work ok in the next while
Cheers

m00nie
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Feedback

Post by m4s »

Hi m00nie! :)

Thanks for your work!

I tried the script with some urls, and politico.eu gives a strange result.

Web: https://www.politico.eu/article/russia- ... -approval/

Result: https://i.imgur.com/PS8I96P.jpg

Other page:

Web2: https://www.nemzetisport.hu/nemet_labda ... rg-2813859
Result2: www.nemzetisport.hu: 301 Moved Permanently

The script gives this error in case of any link from www.origo.hu:
Tcl error [m00nie::linktitle::autoinfo]: www.origo.hu returned ZERO no data or we couldnt connect properly

Greetings, :)
m
m00nie
Voice
Posts: 14
Joined: Sat Mar 28, 2020 2:02 pm

Post by m00nie »

Hi m4s :)

v1.3 might solve some of the probs you had (I couldn't replicate them all :()
The 301 redirection handling was quite new for me at least but good to poke into. It's definitely not finished but it might be less broken than it was before
Cheers

m00nie
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Post by m4s »

Hi m00nie,

Thanks for your work.

I have tested the v1.3.

The 301 moved permanently error disappeared. The script gives fine result from www.nemzetisport.hu & from www.dw.com as well.

If i post a link from politico.eu containing quotation marks I get these strange results:
& # 8 2 1 6 ; grown-ups & # 8 2 1 7 ; & # 8 2 1 1 ; POLITICO.

But acc to google: & # 8 2 1 6 ; and & # 8 2 1 7 ; = quotation mark (left and right) and & # 8 2 1 1 ; = dash.
(just added space between the characters if a don't i get quotation marks and dash :shock: )

Links from https://www.origo.hu gives this error:
Tcl error [m00nie::linktitle::autoinfo]: can't read "status": no such variable

If i change this line

Code: Select all

putlog "m00nie::linktitle::gettitle $host returned status message of $status."
to

Code: Select all

putlog "m00nie::linktitle::gettitle $host returned status message of status."
the script runs but i get no result.

In DCC i write: .set errorInfo

Currently: can not find channel named "sock55e1c6436b60"
Currently: while executing
Currently: "eof $sock"

My locale:
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_GB.UTF-8
LC_TIME=hu_HU.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_GB.UTF-8
LC_NAME=en_GB.UTF-8
LC_ADDRESS=en_GB.UTF-8
LC_TELEPHONE=en_GB.UTF-8
LC_MEASUREMENT=en_GB.UTF-8
LC_IDENTIFICATION=en_GB.UTF-8
LC_ALL=


Thank you again!
Cheers
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Post by m4s »

Hi again,

I solved the politico problem.
I changed the proc makepretty to this:
https://i.imgur.com/75ceHFw.jpg
and i get fine result.

This page helped me: https://unicode-table.com/en/2013/
So the only problem is now the www.origo.hu.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Could you try a string map instead of regsub?

Code: Select all

proc makepretty {title} {
	return [string map [list "'" "'" "&" "\&" """ "\"" "<" "<" ">" ">" "\n" ""] $title]
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Post by m4s »

Could you try a string map instead of regsub?
If you asked me caesar my answer is I am not coder. :?
I was just lucky found the 'solution' for the "politico" problem. :)


By the way I did some more test and I'm in trouble with hungarian characters.
From a web I got this:
https://i.imgur.com/lkuGDPQ.jpg
Should be: Másfél millióra büntették.

If I add it to the script it works ( https://i.imgur.com/lz9wu9O.jpg ) but is it possible not to give all these characters one by one?

Thank you to everyone! :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

&#225 ; (without the space after the 5 cos forum interprets it) is the Latin small letter a with acute (meaning á) in ASCII table.
Once the game is over, the king and the pawn go back in the same box.
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Post by m4s »

caesar wrote:&#225 ; (without the space after the 5 cos forum interprets it) is the Latin small letter a with acute (meaning á) in ASCII table.
Yes, I know.
Is it possible to modify the script that i do not have to add all of these latin characters one by one?
Online
User avatar
CrazyCat
Revered One
Posts: 1215
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

You can use https://gitlab.com/tcl-scripts/tcl-util ... lutils.tcl

Copy its content in your script, or in another file loaded before your script, and use htmlentities_decode
m
m00nie
Voice
Posts: 14
Joined: Sat Mar 28, 2020 2:02 pm

Post by m00nie »

v1.4 now include the decoding as suggested by CrazyCat :) Thanks for the point in the right direction CrazyCat wouldn't have thought of that so cheers
Cheers

m00nie
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Post by m4s »

m00nie wrote:v1.4 now include the decoding as suggested by CrazyCat :) Thanks for the point in the right direction CrazyCat wouldn't have thought of that so cheers
Cheers

m00nie
Thank you m00nie!
I had to add one more character: "ő" "\&#337 ;"

The script works perfectly thank you for your help!
Thanks for CrazyCat as well!

Grab it: https://www.m00nie.com/eggdrop-url-titl ... ng-script/
User avatar
m4s
Halfop
Posts: 97
Joined: Mon Jan 30, 2017 3:24 pm

Post by m4s »

Hello

I have just got a strange result:
élÅ&#145; adás
Instead of:
elő adás
Why is this happen?

I upgraded my eggdrop from 1.8.4 to 1.9.

Thx!
Online
User avatar
CrazyCat
Revered One
Posts: 1215
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

probably there is a conversion from or to utf8 in the script which is no more required with eggdrop1.9.
Post Reply