We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks for the tool.
I'm using lyrics-in-terminal==1.7.0 with the cycle-source option enabled.
lyrics-in-terminal==1.7.0
cycle-source
When I start lyrics, it attempts to use different sources but eventually crashes with the following exception:
lyrics
Unexpected exception occurred. (<class 'KeyError'>, KeyError('azlyrics'), <traceback object at 0x77dca0d92f40>) 'azlyrics'
Upon debugging, I found that the issue occurs in util.py when the application attempts to fetch Google search HTML:
util.py
def get_html(url, header=HEADER, cookies=COOKIES) -> str | Tuple[str, Exception]: ''' returns html text from given url ''' try: resp = requests.get(url, headers=header)
Instead of the expected content, it receives a cookie consent banner:
To bypass this, I manually approved the consent in my browser, extracted the SOCS cookie, and updated the lyrics code as follows:
SOCS
HEADER = { 'User-Agent': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch' } COOKIES = { 'SOCS': 'CAESHAgBEhJnd3NfMjAyNTAxMjMtMF9SQzEaAnN2IAEaBgiAmdu8Bg' } <...> def get_html(url, header=HEADER, cookies=COOKIES) -> str | Tuple[str, Exception]: ''' returns html text from given url ''' try: resp = requests.get(url, headers=header, cookies=cookies)
However, I then encountered a screen instructing to enable JavaScript to continue searching:
Since both azlyrics and genius depend on the initial HTML from Google, lyrics cannot find links in the received None HTML.
azlyrics
genius
None
I tried various User-Agent strings with/without cookie 'CONSENT': 'PENDING+987' but couldn't resolve the issue.
User-Agent
'CONSENT': 'PENDING+987'
To reproduce the issue, ensure that the IP address is located in Europe.
The text was updated successfully, but these errors were encountered:
I created a fork that utilizes the Genius API.
genius_token
[OPTIONS]
~/.config/lyrics-in-terminal/lyrics.cfg
To install:
pip install git+https://github.com/DmitrySandalov/lyrics-in-terminal@Use-Genius-API-(third-party-dependency)-instead-of-parsing-HTML
@Jugran What are your thoughts on using the API instead of HTML parsing?
Feel free to use my code.
Sorry, something went wrong.
No branches or pull requests
Thanks for the tool.
I'm using
lyrics-in-terminal==1.7.0
with thecycle-source
option enabled.When I start
lyrics
, it attempts to use different sources but eventually crashes with the following exception:Upon debugging, I found that the issue occurs in
util.py
when the application attempts to fetch Google search HTML:Instead of the expected content, it receives a cookie consent banner:
To bypass this, I manually approved the consent in my browser, extracted the
SOCS
cookie, and updated the lyrics code as follows:util.py
However, I then encountered a screen instructing to enable JavaScript to continue searching:
Since both
azlyrics
andgenius
depend on the initial HTML from Google,lyrics
cannot find links in the receivedNone
HTML.I tried various
User-Agent
strings with/without cookie'CONSENT': 'PENDING+987'
but couldn't resolve the issue.To reproduce the issue, ensure that the IP address is located in Europe.
The text was updated successfully, but these errors were encountered: