Can anyone help figure out how to make a lyric display conky that uses google? [SOLVED]
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
- Logansfury
- 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]
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.
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.
Re: Can anyone help figure out how to make a lyric display conky that uses google?
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 would want to search for, in this case, "google song lyrics api" or something like that instead.
- Logansfury
- 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?
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.
Re: Can anyone help figure out how to make a lyric display conky that uses google?
A simple wget doesn't work because you need to be logged in into google.
- Logansfury
- 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?
Can the required logon be scripted?
Re: Can anyone help figure out how to make a lyric display conky that uses google?
That's not easy. It should be possible with chromium and a headless profile. I did it before, but lots of work..
- Logansfury
- 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?
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?
- Logansfury
- 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?
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.
Re: Can anyone help figure out how to make a lyric display conky that uses google?
sudo apt install lyrics
does not find a program lyrics..- Logansfury
- 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?
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 installedpip install lyrics-in-terminal
Re: Can anyone help figure out how to make a lyric display conky that uses google?
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'
- Logansfury
- 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?
Holy crap, it went right on my system no sweat, I can't begin to understand why it would error on yours.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'
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.
Re: Can anyone help figure out how to make a lyric display conky that uses google?
I'm going through my own problems ATM. At every boot the soundcard settings are wrong.. it picks the wrong device.
- Logansfury
- 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?
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
Re: Can anyone help figure out how to make a lyric display conky that uses google?
I assume you're on Mint 21 or 22.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.
Using theCode: 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'
|
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'
$
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
Last edited by zahlman on Sat Nov 30, 2024 2:08 pm, edited 1 time in total.
- Logansfury
- 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?
Hello Zahlman,zahlman wrote: ⤴Sat Nov 30, 2024 2:00 pmI assume you're on Mint 21 or 22.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.
Using theCode: 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'
|
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:
(I have specific-version Pythons separately built and aliased like this on my system specifically for testing this kind of thing.)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' $
To support earlier Python (as long as it supports type annotations at all!) you need to usetyping.Union
.
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
Re: Can anyone help figure out how to make a lyric display conky that uses google?
Nah, I just copied and pasted Koentje's stack traceLogansfury wrote: ⤴Sat Nov 30, 2024 2:05 pm It looks like you identified the location of several important files that LIT uses.
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... )
- Logansfury
- 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?
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 >.<zahlman wrote: ⤴Sat Nov 30, 2024 2:13 pmNah, I just copied and pasted Koentje's stack traceLogansfury wrote: ⤴Sat Nov 30, 2024 2:05 pm It looks like you identified the location of several important files that LIT uses.
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... )
Re: Can anyone help figure out how to make a lyric display conky that uses google?
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
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
- Logansfury
- 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?
Far out!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