| View previous topic :: View next topic |
| Author |
Message |
m4s Halfop

Joined: 30 Jan 2017 Posts: 97
|
Posted: Sun May 17, 2020 5:23 am Post subject: |
|
|
Yes, I also got an error message.
[11:20] Tcl error [m00nie::youtube::autoinfo]: unable to convert date-time string "2020-05-16T11:51:42Z": more than one time zone in string |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sun May 17, 2020 8:21 am Post subject: |
|
|
i havent checked the script but on guess of what i know there must be a area to set the timezone and most lightly like this
| Code: |
set timezone "timezone"
|
and check if both " " are there and not just one
i'll look at the script in a bit  _________________ ComputerTech |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun May 17, 2020 10:30 am Post subject: |
|
|
Not sure what this 2 lines
| Code: |
regsub {\.000Z} $pubiso "" pubiso
regsub -all {Z} $pubiso "" pubiso
|
are supposed to do since don't have the code running and can only guess..
Anyway, replacing the:
| Code: |
set pubtime [clock format [clock scan $pubiso]]
|
with:
| Code: |
set pubtime [clock format [clock scan [string map [list "T" " " "Z" ""] $pubiso]]]
|
should do the trick. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun May 17, 2020 11:14 am Post subject: |
|
|
| excellent that seems to do it caesar tnx for the swift reply and fix |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun May 17, 2020 11:40 am Post subject: |
|
|
in all fairness i must comment that m00nie seems to already have fixed that bug in his latest release as i didnt check his latest release i just did
just wanted to say this but none the less thx caesar for providing a quick fix |
|
| Back to top |
|
 |
m4s Halfop

Joined: 30 Jan 2017 Posts: 97
|
Posted: Sun May 17, 2020 12:45 pm Post subject: |
|
|
Oh, I did not check either.
Thanks to everyone! |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon May 18, 2020 1:28 am Post subject: |
|
|
I looked on the website at comments section and saw an output from YouTube's API:
| Code: |
[14:53:42] m00nie::youtube::getinfo IDS are {snippet {publishedAt 2015-08-10T22:24:25.000Z title {IFC's VICE Parody: 'DRONEZ' (Full Episode)} channelTitle VICE} contentDetails {duration PT22M52S} statistics {viewCount 36205}}
|
and notice the 'publishedAt' is 2015-08-10T22:24:25.000Z
Those two lines I was puzzled about:
| Code: |
regsub {\.000Z} $pubiso "" pubiso
regsub -all {Z} $pubiso "" pubiso
|
do this:
| Code: |
% set pubiso "2015-08-10T22:24:25.000Z"
2015-08-10T22:24:25.000Z
% regsub {\.000Z} $pubiso "" pubiso
1
% regsub -all {Z} $pubiso "" pubiso
0
% puts $pubiso
2015-08-10T22:24:25
% clock format [clock scan $pubiso]
Tue Aug 11 08:24:25 EEST 2015
|
From here I notice two things:
1. The presence of the T in the $pubiso
2. The 'clock format' output is WRONG because the '2015-08-10 22:24:25' (notice that i just removed the T) becomes 'Tue Aug 11 08:24:25 EEST 2015' after 'clock format'
I would just ditch those 'regsub' lines and just use 'string map' instead:
| Code: |
set pubiso [string map {"T" " " ".000Z" ""} $pubiso]
|
while keeping the original:
| Code: |
set pubtime [clock format [clock scan $pubiso]]
|
and thus ignoring my previous fix. The output is clean as it should be:
| Code: |
% set pubiso "2015-08-10T22:24:25.000Z"
2015-08-10T22:24:25.000Z
% set pubiso [string map {"T" " " ".000Z" ""} $pubiso]
2015-08-10 22:24:25
|
so this means that after 'clock format' the formatted date is correct:
| Code: |
% clock format [clock scan $pubiso]
Mon Aug 10 22:24:25 EEST 2015
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
m00nie Voice
Joined: 28 Mar 2020 Posts: 14
|
Posted: Tue May 19, 2020 3:41 am Post subject: |
|
|
Hi Caesar ☺️
Thanks for the spot on the date being red incorrectly.ive updated the script to sort this along with your suggestion of the string maps (which I've never used before now so nice to learn something cleaner 😁)
The change that broke the script though is the API now randomly(?) seems to append a single Z rather than the expected .000Z we got before (something to do with recommend way to pass time in C+)
v2.4 should hopefully fix both probs
Cheers
m00nie |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue May 19, 2020 9:43 am Post subject: |
|
|
hey there m00nie i loaded your youtube tcl 2.4 in tcl pastebin and it returned a few errors
| Quote: |
Line 36: ERROR: Unknown variable "m00nie::youtube::regex"
Line 40: ERROR: Unknown variable "m00nie::youtube::key"
Line 79: ERROR: Unknown variable "m00nie::youtube::user_throt"
Line 80: ERROR: Unknown variable "m00nie::youtube::chan_throt"
Line 81: ERROR: Unknown variable "m00nie::youtube::link_throt"
Line 89: NOTICE: Found constant "rawpage" which is also a variable.
Line 93: WARNING: Unknown command "json::json2dict"
Line 105: ERROR: Unknown variable "m00nie::youtube::key"
|
|
|
| Back to top |
|
 |
bugme Voice
Joined: 13 Jan 2017 Posts: 6
|
Posted: Tue Jun 16, 2020 2:53 am Post subject: |
|
|
I can see some problems with the code page with non-English names.
example: https://www.youtube.com/watch?v=YcaWvpYt7oI
m00nie-youtube.2.4.tcl
result: | Code: | | GJ8Þó ,40q Á_n -Mè-��#GJ8Þó #á |
expected result: | Code: | | GJ8マン 第40話 『私、見たの! -前編-』 #GJ8マン #郡上八幡 #さくらももこ |
| Quote: | debian:bullsey
eggdrop 1.8.4
tcl 8.6.9
tcl-tls 1.7.21
tclcurl 7.22.0+hg20160822-2
tcllib 1.20 |
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jun 16, 2020 8:11 am Post subject: |
|
|
| works fine for me with any lang |
|
| Back to top |
|
 |
m00nie Voice
Joined: 28 Mar 2020 Posts: 14
|
Posted: Thu Jun 18, 2020 3:44 pm Post subject: |
|
|
Hi bugme
I think you might need to check your bot is compiled with UTF-8 support or what the default encoding is on your OS. I had to recompile some of my older hosted bots to get UTF-8 working properly
Cheers
m00nie |
|
| Back to top |
|
 |
bugme Voice
Joined: 13 Jan 2017 Posts: 6
|
Posted: Thu Jun 18, 2020 4:42 pm Post subject: |
|
|
| m00nie wrote: | Hi bugme
default encoding is on your OS.
m00nie |
Yes. You're right
I use docker container. I forgot to check locale
| Code: | locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
|
Updated Dockerfile. Problem solved. Thanks for the tip
p.s.
It is strange that this script does not have this problem, even with non-update locale http://forum.egghelp.org/viewtopic.php?p=108565#108565 |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Aug 10, 2020 5:23 pm Post subject: |
|
|
for some reason on a particular box i cant get m00nies YT tcl to output in utf-8
while : .tcl encoding system
shows : Tcl: utf-8
im puzzled what else to try
eggdrop v1.8.4
Tcl library: /usr/share/tcltk/tcl8.6
Tcl version: 8.6.10 (header version 8.6.10)
Tcl is threaded
TLS support is enabled
TLS library: OpenSSL 1.1.1f 31 Mar 2020
for locale this is what we have:
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL= |
|
| Back to top |
|
 |
|