Skip to content
New issue

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

Feature request: Add Country of origin and Language #24

Open
cvjensen opened this issue May 2, 2024 · 1 comment
Open

Feature request: Add Country of origin and Language #24

cvjensen opened this issue May 2, 2024 · 1 comment

Comments

@cvjensen
Copy link

cvjensen commented May 2, 2024

Is it possible to make PyMovieDb return Country of origin and Language also?

@cvjensen
Copy link
Author

cvjensen commented May 2, 2024

I found this

response.html.xpath("//script[@id='__NEXT_DATA__']")[0].text

that returns ALOOOT more data like

            nextdata = response.html.xpath("//script[@id='__NEXT_DATA__']")[0].text
            nextdata = ''.join(nextdata.splitlines())  # removing newlines
            nextdata = f"""{nextdata}"""
            nextdata = json.loads(nextdata)
            #print(json.dumps(nextdata, indent=2))
            countries = [country['id'] for country in nextdata['props']['pageProps']['mainColumnData']['countriesOfOrigin']['countries']]
            print(countries)

            languages = [language['id'] for language in nextdata['props']['pageProps']['mainColumnData']['spokenLanguages']['spokenLanguages']]
            print(languages)
python test.py
['US']
['en']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant