OrfiDev / orpheusdl-musixmatch

19 stars 2 forks source link

can not get lyrics from musixmatch #2

Closed woliu closed 1 year ago

woliu commented 2 years ago

python orpheus.py -lr musixmatch https://open.qobuz.com/album/c9wsrrjh49ftb i don't know why i can not get lyrics. please help me

OrfiDev commented 2 years ago

@woliu What does Orpheus output when you run that command?

woliu commented 2 years ago

first thank your reply. second i try to change the code in my way(get token then get lyrics from musixmatch)

def get_user_token(self):
    r = self.s.get(f'{self.API_URL}token.get', headers=self.headers, params={
        'user_language': 'en', 'app_id': 'web-desktop-app-v1.0'
    }, cookies={
        'AWSELB': '0', 'AWSELBCORS': '0'
    })

    r = r.json()
    if r['message']['header']['status_code'] == 401 and r['message']['header']['hint'] == 'captcha':
        raise CaptchaError('Captcha required')
    elif r['message']['header']['status_code'] != 200:
        raise self.exception(f"Error: {r['message']['header']['hint']}")

    self.user_token = r['message']['body']['user_token']
    if self.user_token == 'UpgradeOnlyUpgradeOnlyUpgradeOnlyUpgradeOnly':
        raise UserTokenError('Getting user token failed')
    return self.user_token

def get_lyrics(self,token:str, query: dict):
    params = {
        'usertoken': token,
        'app_id': 'web-desktop-app-v1.0',
    }
    params.update(query)

    print(params)
    r = self.s.get('https://apic-desktop.musixmatch.com/ws/1.1/track.lyrics.get', params=params, headers=self.headers, cookies={
        'AWSELB': '0', 'AWSELBCORS': '0'
    })

    if r.status_code not in [200, 201, 202]:
        raise self.exception(r.text)

    r = r.json()
    print(r)

lyrics = Musixmatch.get_lyrics(token,{'track_id': 117615}) print(lyrics)

i run the code. return none. i don't know the url is error or the parms is error? please help me.

OrfiDev commented 2 years ago

@woliu have you checked that the Musixmatch app itself can get the lyrics to that track?

woliu commented 2 years ago

{'message': {'header': {'status_code': 404, 'execute_time': 0.0028831958770752}, 'body': []}}

track_id:15953433 please help me.thank you

Dniel97 commented 2 years ago

Try the develop branch for testing.

woliu commented 2 years ago

thank you