Can anyone help figure out how to make a lyric display conky that uses google? [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Can anyone help figure out how to make a lyric display conky that uses google? [SOLVED]

Post by Logansfury »

Hello Everyone,

I have 4 lyric display conkys atm: Koentje's lyrics v1.3, my adaptation of Koentje's lyrics v1.2 using makeitpersonal.co database, my adaptation of Koentje's lyrics v1.3 using the irclib database, and the AZLyrics python app I found online.

Long before these conkys were created I had installed Lyrics-in-Terminal. When running Lyrics-in-Terminal alongside the four conkys, I have noted that it gets the lyrics for numerous songs that all 4 conkys return a "lyrics not found" for.

I emailed support for LIT and asked them what database they used and they identified it as google lyrics search.

I have tried testing with a song that LIT always gets the lyrics for, Tom Sawyer by RUSH. I have tried with a bot coded bash script that cant get lyrics with either a variable, or the rush song:

https://www.google.com/search?q=rush+tom+sawyer+lyrics

https://www.google.com/search?q=rush%20 ... r%20lyrics

Does anyone have any idea why this URL isnt returning lyrics? How do I find the right URL? I have googled for "google search engine URL" but nothing helpful seemed to come up.
Last edited by Logansfury on Fri Dec 06, 2024 5:36 pm, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 10
Level 10
Posts: 3018
Joined: Wed Oct 19, 2016 6:08 pm

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by zcot »

I click both of those links and end up with exactly the same search result and it does have the lyrics shown outright, along with other interesting info.

I would want to search for, in this case, "google song lyrics api" or something like that instead.
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

zcot wrote: Mon Nov 25, 2024 10:21 pm I click both of those links and end up with exactly the same search result and it does have the lyrics shown outright, along with other interesting info.

I would want to search for, in this case, "google song lyrics api" or something like that instead.
I was told by the coders of LIT that there was no API, they just did a wget or something similar. I send another message to them asking the syntax of their command for getting google lyrics, but they have not yet responded to that.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2220
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Koentje »

A simple wget doesn't work because you need to be logged in into google.
Image
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

Koentje wrote: Tue Nov 26, 2024 1:28 am A simple wget doesn't work because you need to be logged in into google.
Can the required logon be scripted?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2220
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Koentje »

That's not easy. It should be possible with chromium and a headless profile. I did it before, but lots of work..
Image
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

Koentje wrote: Tue Nov 26, 2024 2:48 pm That's not easy. It should be possible with chromium and a headless profile. I did it before, but lots of work..
If the Lyrics In Terminal has placed any files on my system, might any clues to how they get lyrics and redirect them to the open terminal be in there? Kind of a reverse engineering thing?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

Koentje wrote: Tue Nov 26, 2024 1:28 am A simple wget doesn't work because you need to be logged in into google.
Lyrics in Terminal seems to get around that. I dont recall ever having to do a login, I just did the sudo apt install command and the next time I opened a terminal and entered the text "lyrics" it displayed song lyrics.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2220
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Koentje »

sudo apt install lyrics does not find a program lyrics..
Image
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

Koentje wrote: Wed Nov 27, 2024 1:26 pm sudo apt install lyrics does not find a program lyrics..
I'm sorry my post was misleading about the install. It's python based :)

The 2 commands to get lyrics installed are:

sudo apt install python3-pip -- if necessary most already have installed

pip install lyrics-in-terminal
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2220
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Koentje »

Great program...

Code: Select all

Traceback (most recent call last):
  File "/home/admin/.local/bin/lyt", line 5, in <module>
    from lyrics.lyrics_in_terminal import main
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/lyrics_in_terminal.py", line 6, in <module>
    from lyrics.player import Player
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/player.py", line 3, in <module>
    from lyrics.track import Track
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/track.py", line 3, in <module>
    from lyrics import util
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/util.py", line 33, in <module>
    def get_html(url, header=HEADER) -> str | Tuple[str, Exception]:
TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias'
Image
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

Koentje wrote: Wed Nov 27, 2024 2:46 pm Great program...

Code: Select all

Traceback (most recent call last):
  File "/home/admin/.local/bin/lyt", line 5, in <module>
    from lyrics.lyrics_in_terminal import main
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/lyrics_in_terminal.py", line 6, in <module>
    from lyrics.player import Player
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/player.py", line 3, in <module>
    from lyrics.track import Track
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/track.py", line 3, in <module>
    from lyrics import util
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/util.py", line 33, in <module>
    def get_html(url, header=HEADER) -> str | Tuple[str, Exception]:
TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias'
Holy crap, it went right on my system no sweat, I can't begin to understand why it would error on yours.

If you're still willing, all your credentials on my system are unchanged, if you want to remote in and check my LIT files directly you're welcome to.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2220
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Koentje »

I'm going through my own problems ATM. At every boot the soundcard settings are wrong.. it picks the wrong device.
Image
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

Koentje wrote: Wed Nov 27, 2024 3:18 pm I'm going through my own problems ATM. At every boot the soundcard settings are wrong.. it picks the wrong device.
Yikes, I'm sorry to hear that. Should you get yourself straightened out and are still willing you are more than welcome to remote in and check out my LIT files or install it to your directories on the system. Good luck :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
zahlman
Level 3
Level 3
Posts: 165
Joined: Mon Apr 17, 2023 12:46 pm

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by zahlman »

Logansfury wrote: Wed Nov 27, 2024 2:50 pm Holy crap, it went right on my system no sweat, I can't begin to understand why it would error on yours.
I assume you're on Mint 21 or 22.

Code: Select all

Traceback (most recent call last):
  File "/home/admin/.local/bin/lyt", line 5, in <module>
    from lyrics.lyrics_in_terminal import main
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/lyrics_in_terminal.py", line 6, in <module>
    from lyrics.player import Player
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/player.py", line 3, in <module>
    from lyrics.track import Track
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/track.py", line 3, in <module>
    from lyrics import util
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/util.py", line 33, in <module>
    def get_html(url, header=HEADER) -> str | Tuple[str, Exception]:
TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias'
Using the | operator with types this way requires Python 3.10 or higher. (Of course, this type annotation has no effect on the running code and is only a development tool anyway.) See:

Code: Select all

$ py3.8 -c 'def foo() -> str | int: pass'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'type'
$ py3.9 -c 'def foo() -> str | int: pass'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'type'
$ py3.10 -c 'def foo() -> str | int: pass'
$ 
(I have specific-version Pythons separately built and aliased like this on my system specifically for testing this kind of thing.)

To support earlier Python (as long as it supports type annotations at all!) you need to use typing.Union.

Edit: the project in question claims compatibility with 3.7 and up, so that should be considered a bug :evil:
Last edited by zahlman on Sat Nov 30, 2024 2:08 pm, edited 1 time in total.
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

zahlman wrote: Sat Nov 30, 2024 2:00 pm
Logansfury wrote: Wed Nov 27, 2024 2:50 pm Holy crap, it went right on my system no sweat, I can't begin to understand why it would error on yours.
I assume you're on Mint 21 or 22.

Code: Select all

Traceback (most recent call last):
  File "/home/admin/.local/bin/lyt", line 5, in <module>
    from lyrics.lyrics_in_terminal import main
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/lyrics_in_terminal.py", line 6, in <module>
    from lyrics.player import Player
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/player.py", line 3, in <module>
    from lyrics.track import Track
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/track.py", line 3, in <module>
    from lyrics import util
  File "/home/admin/.local/lib/python3.8/site-packages/lyrics/util.py", line 33, in <module>
    def get_html(url, header=HEADER) -> str | Tuple[str, Exception]:
TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias'
Using the | operator with types this way requires Python 3.10 or higher. (Of course, this type annotation has no effect on the running code and is only a development tool anyway.) See:

Code: Select all

$ py3.8 -c 'def foo() -> str | int: pass'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'type'
$ py3.9 -c 'def foo() -> str | int: pass'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'type'
$ py3.10 -c 'def foo() -> str | int: pass'
$ 
(I have specific-version Pythons separately built and aliased like this on my system specifically for testing this kind of thing.)

To support earlier Python (as long as it supports type annotations at all!) you need to use typing.Union.
Hello Zahlman,

Welcome to the thread!

The box I am working on for this is Linux Mint 21.3 | Cinnamon with the latest Python3 installed.

It looks like you identified the location of several important files that LIT uses. I will examine these and hope to find a wget statement or something similar.

Thank you for taking the time to help :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
zahlman
Level 3
Level 3
Posts: 165
Joined: Mon Apr 17, 2023 12:46 pm

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by zahlman »

Logansfury wrote: Sat Nov 30, 2024 2:05 pm It looks like you identified the location of several important files that LIT uses.
Nah, I just copied and pasted Koentje's stack trace :wink:

The project is on GitHub, as is usual for this sort of thing. It doesn't look like very much code. Your install location may vary, of course.

As I edited in, the code is supposed to support 3.7 and up. (Or if they want to use features like this going forward, they need to stop advertising such support.) Likely this type annotation was added more recently. I'll file a bug report and possibly a pull request for it. (And maybe I can teach them to use proper modern packaging for such a simple, pure Python project... :twisted: )
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

zahlman wrote: Sat Nov 30, 2024 2:13 pm
Logansfury wrote: Sat Nov 30, 2024 2:05 pm It looks like you identified the location of several important files that LIT uses.
Nah, I just copied and pasted Koentje's stack trace :wink:

The project is on GitHub, as is usual for this sort of thing. It doesn't look like very much code. Your install location may vary, of course.

As I edited in, the code is supposed to support 3.7 and up. (Or if they want to use features like this going forward, they need to stop advertising such support.) Likely this type annotation was added more recently. I'll file a bug report and possibly a pull request for it. (And maybe I can teach them to use proper modern packaging for such a simple, pure Python project... :twisted: )
Well the chatgpt seems to have run out of gas. It was able to make bash and python scripts for 3 separate lyrics sites, but for genius or google it is failing miserably. I just gave it the main python script of LIT and asked for an edit conky could control and it cannot seem to be able to write a lyrics.txt for conky to display with a cat command >.<
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
zahlman
Level 3
Level 3
Posts: 165
Joined: Mon Apr 17, 2023 12:46 pm

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by zahlman »

I'm afraid I can't help with the Conky issue (and nothing I said previously had anything to do with it, frankly).

But I did submit a bug report for the version incompatibility issue, and I also offered a pull request to modernize how the code is packaged :D
User avatar
Logansfury
Level 9
Level 9
Posts: 2843
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Can anyone help figure out how to make a lyric display conky that uses google?

Post by Logansfury »

zahlman wrote: Wed Dec 04, 2024 2:51 am I'm afraid I can't help with the Conky issue (and nothing I said previously had anything to do with it, frankly).

But I did submit a bug report for the version incompatibility issue, and I also offered a pull request to modernize how the code is packaged :D
Far out!
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
Post Reply

Return to “Compiz, Conky, Docks & Widgets”