Coder Social home page Coder Social logo

nmcassa / letterboxdpy Goto Github PK

View Code? Open in Web Editor NEW
34.0 3.0 12.0 1.92 MB

A letterboxd webscraper

Home Page: https://pypi.org/project/letterboxdpy/

License: MIT License

Python 100.00%
python webscraper letterboxd json library movie movies api

letterboxdpy's Issues

Some Movie Data isn't populated

Some meta data for new or very small movies aren't added.
Searching through some movies it looks like they just arent there.

Probably need to add some try catches and just not populate some variables for movies

If movie title begins with a capital letter, no movie is found

If you begin the movie title with a capital letter, for example:

if __name__ == "__main__":
    king = Movie("King kong")
    print(king)

You get:

...
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/letterboxdpy/movie.py", line 178, in <module>
    king = Movie("King kong")
  File "/opt/homebrew/lib/python3.10/site-packages/letterboxdpy/movie.py", line 25, in __init__
    self.movie_genre(page)
  File "/opt/homebrew/lib/python3.10/site-packages/letterboxdpy/movie.py", line 91, in movie_genre
    raise Exception("No movie found")
Exception: No movie found

To resolve, you could either update the README to reflect this or update https://github.com/nmcassa/letterboxdpy/blob/main/src/letterboxdpy/movie.py#L14 to automatically convert the title to lowercase with:

self.title = title.replace(' ', '-').lower()

Movie example not working

Just using the code in the movie example in the readme:

from letterboxdpy import movie
king = Movie("king kong")
print(king)
king = Movie("king kong", 2005)
print(king)
house = Movie("/film/the-house-2022-1/")
print(house)

I get:

Traceback (most recent call last):
  File "/Users/bs/Sites/Letterblocksd/Scripts/newScraper/BeScrapes.py", line 2, in <module>
    king = Movie("king kong")
           ^^^^^
NameError: name 'Movie' is not defined. Did you mean: 'movie'?

I believe the readme should have movie.Movie

Empty aggregateRating Issue

Traceback (most recent call last):
  File "C:\Users\user\react\letterboxdwatchlist\backend\api.py", line 17, in <module>
    movie_instance = movie.Movie("eline-vere")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\letterboxdpy\movie.py", line 27, in __init__
    self.movie_rating(dom, script)
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\letterboxdpy\movie.py", line 56, in movie_rating
    script['aggregateRating']['ratingValue'] if script else None
    ~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'aggregateRating'

Movie link: https://letterboxd.com/film/eline-vere/
I am on latest git version
pip install git+https://github.com/nmcassa/letterboxdpy.git
To reproduce

from letterboxdpy import movie
movie_instance = movie.Movie("eline-vere")
print(movie_instance)

I think there should be a check whether a movie has a rating or not.

parser library not found

Hey!
Firstly i'd like to sat that this seems to be a great project but I am getting an FeatureNotFoundError while trying to run the code
Screenshot 2024-01-23 at 20 04 17

I have installed bs4 and lxml
Screenshot 2024-01-23 at 20 06 10
Screenshot 2024-01-23 at 20 06 33

It would be a great if you could help me with this!!

Duplicate Movie Titles

Movies that have the same title (arrival (2013), arrival (1980), arrival (2016)) have different url's with the year in the top.
So far no way to specify movie.

Could search the name and pick the most popular.
Could add a constructor that takes a year to get more accurate.

can't find users

Hello, I've used letterboxdpy in the past with no issues at all, but just to gather data about movies.

I'm tying now to do the same with users, but I keep getting the errors ''NoneType object has no attribute 'text'' and then 'No user found', even when using the example provided in the readme.md.

from letterboxdpy import user
nick = user.User("nmcassa")
print(nick)

these are the errors I get:

Screenshot 2023-11-23 155850

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.