egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Solved] m00nie eggdrop URL title grabbing script
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Wed Mar 03, 2021 1:43 pm    Post subject: [Solved] m00nie eggdrop URL title grabbing script Reply with quote

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 Smile ) 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-script-using-api-v3/


Last edited by m4s on Thu Mar 25, 2021 2:12 pm; edited 2 times in total
Back to top
View user's profile Send private message
m00nie
Voice


Joined: 28 Mar 2020
Posts: 14

PostPosted: Sat Mar 06, 2021 5:28 pm    Post subject: Reply with quote

Hi m4s Very Happy

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
Back to top
View user's profile Send private message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Sun Mar 07, 2021 2:22 am    Post subject: Feedback Reply with quote

Hi m00nie! Smile

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-sputnik-v-coronavirus-vaccine-eu-ema-approval/

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

Other page:

Web2: https://www.nemzetisport.hu/nemet_labdarugas/bundesliga-hertha-augsburg-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, Smile
Back to top
View user's profile Send private message
m00nie
Voice


Joined: 28 Mar 2020
Posts: 14

PostPosted: Sun Mar 21, 2021 4:48 pm    Post subject: Reply with quote

Hi m4s Smile

v1.3 might solve some of the probs you had (I couldn't replicate them all Sad)
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
Back to top
View user's profile Send private message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Mon Mar 22, 2021 3:22 am    Post subject: Reply with quote

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 Shocked )

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:
putlog "m00nie::linktitle::gettitle $host returned status message of $status."

to
Code:
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
Back to top
View user's profile Send private message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Mon Mar 22, 2021 5:13 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3733
Location: Mint Factory

PostPosted: Mon Mar 22, 2021 7:09 am    Post subject: Reply with quote

Could you try a string map instead of regsub?
Code:

proc makepretty {title} {
   return [string map [list "&#x27;" "'" "&amp;" "\&" "&quot;" "\"" "&lt;" "<" "&gt;" ">" "\n" ""] $title]
}

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Tue Mar 23, 2021 3:47 am    Post subject: Reply with quote

Quote:
Could you try a string map instead of regsub?


If you asked me caesar my answer is I am not coder. Confused
I was just lucky found the 'solution' for the "politico" problem. Smile


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! Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3733
Location: Mint Factory

PostPosted: Tue Mar 23, 2021 3:01 pm    Post subject: Reply with quote

&#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.
Back to top
View user's profile Send private message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Wed Mar 24, 2021 11:26 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 848
Location: France

PostPosted: Wed Mar 24, 2021 12:00 pm    Post subject: Reply with quote

You can use https://gitlab.com/tcl-scripts/tcl-utilities/-/blob/master/htmlutils.tcl

Copy its content in your script, or in another file loaded before your script, and use htmlentities_decode
_________________
https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
m00nie
Voice


Joined: 28 Mar 2020
Posts: 14

PostPosted: Wed Mar 24, 2021 4:35 pm    Post subject: Reply with quote

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

m00nie
Back to top
View user's profile Send private message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Thu Mar 25, 2021 2:12 pm    Post subject: Reply with quote

m00nie wrote:
v1.4 now include the decoding as suggested by CrazyCat Smile 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-title-grabbing-script/
Back to top
View user's profile Send private message
m4s
Halfop


Joined: 30 Jan 2017
Posts: 97

PostPosted: Sun Mar 28, 2021 2:56 pm    Post subject: Reply with quote

Hello

I have just got a strange result:

Quote:
élő adás


Instead of:

Quote:
elő adás


Why is this happen?

I upgraded my eggdrop from 1.8.4 to 1.9.

Thx!
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 848
Location: France

PostPosted: Sun Mar 28, 2021 6:42 pm    Post subject: Reply with quote

probably there is a conversion from or to utf8 in the script which is no more required with eggdrop1.9.
_________________
https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber