Giter VIP home page Giter VIP logo

letterboxdpy's Introduction

letterboxdpy

PyPI version Downloads format

Installation

From PyPI

You can easily install the stable version of letterboxdpy from PyPI using pip:

pip install letterboxdpy

From GitHub Repository

Alternatively, if you wish to access the latest (potentially unstable) version directly from the GitHub repository, you can execute the following command:

pip install git+https://github.com/nmcassa/letterboxdpy.git

Note: Please be aware that installing directly from the GitHub repository might give you access to the most recent features and bug fixes, but it could also include changes that haven't been thoroughly tested and may not be stable for production use.

Directory

User Object

from letterboxdpy.user import User
user_instance = User("nmcassa")
print(user_instance)
Click to expand User object response
{
  "scraper": {...},
  "username": "nmcassa",
  "url": "https://letterboxd.com/nmcassa",
  "id": "1500306",
  "is_hq": false,
  "display_name": "nmcassa",
  "bio": null,
  "location": null,
  "website": null,
  "watchlist_length": 64,
  "stats": {
    "films": 560,
    "this_year": 37,
    "list": 1,
    "following": 10,
    "followers": 8
  },
  "favorites": {
    "95113": {
      "slug": "the-grand-budapest-hotel",
      "name": "The Grand Budapest Hotel"
    },...
  },
  "avatar": {
    "exists": true,
    "upscaled": true,
    "url": "https://a.ltrbxd.com/resized/avatar/upload/1/5/0/0/3/0/6/shard/avtr-0-1000-0-1000-crop.jpg"
  },
  "recent": {
    "watchlist": {
      "7023": {
        "name": "The Man Who Stole the Sun",
        "slug": "the-man-who-stole-the-sun"
      },...
    },
    "diary": {
      "months": {
        "4": [
          [
            "16",
            "Civil War"
          ],...
        ],
        "3": [
          [
            "30",
            "Dune"
          ],...
        ]
      }
    }
  }
}

Movie Object

from letterboxdpy.movie import Movie
movie_instance = Movie("v-for-vendetta")
print(movie_instance)
Click to expand Movie object response
{
  "scraper": {...},
  "url": "https://letterboxd.com/film/v-for-vendetta",
  "slug": "v-for-vendetta",
  "letterboxd_id": 51400,
  "title": "V for Vendetta",
  "original_title": null,
  "runtime": 132,
  "rating": 3.84,
  "year": 2005,
  "tmdb_link": "https://www.themoviedb.org/movie/752/",
  "imdb_link": "http://www.imdb.com/title/tt0434409/maindetails",
  "poster": "https://a.ltrbxd.com/resized/film-poster/5/1/4/0/0/51400-v-for-vendetta-0-230-0-345-crop.jpg",
  "banner": "https://a.ltrbxd.com/resized/sm/upload/mx/jg/tz/ni/v-for-vendetta-1920-1920-1080-1080-crop-000000.jpg",
  "tagline": "People should not be afraid of their governments. Governments should be afraid of their people.",
  "description": "In a world in which Great Britain has become a fascist state, a masked vigilante known only as \u201cV\u201d conducts guerrilla warfare against the oppressive British government. When V rescues a young woman from the secret police, he finds in her an ally with whom he can continue his fight to free the people of Britain.",
  "trailer": {
    "id": "V5VGq23aZ-g",
    "link": "https://www.youtube.com/watch?v=V5VGq23aZ-g",
    "embed_url": "https://www.youtube.com/embed/V5VGq23aZ-g"
  },
  "alternative_titles": [
    "Vendetta \u00fc\u00e7\u00fcn V",
    "O za osvetu",...
  ],
  "details": [
    {
      "type": "studio",
      "name": "Virtual Studios",
      "slug": "virtual-studios",
      "url": "https://letterboxd.com/studio/virtual-studios/"
    },...
  ],
  "genres": [
    {
      "type": "genre",
      "name": "Thriller",
      "slug": "thriller",
      "url": "https://letterboxd.com/films/genre/thriller/"
    },...
  ],
  "cast": [
    {
      "name": "Natalie Portman",
      "role_name": "Evey Hammond",
      "slug": "natalie-portman",
      "url": "https://letterboxd.com/actor/natalie-portman/"
    },...
  ],
  "crew": {
    "director": [
      {
        "name": "James McTeigue",
        "slug": "james-mcteigue",
        "url": "https://letterboxd.com/director/james-mcteigue/"
      }
    ],
    "producer": [
      {
        "name": "Grant Hill",
        "slug": "grant-hill",
        "url": "https://letterboxd.com/producer/grant-hill/"
      },...
    ],...
  },
  "popular_reviews": [
    {
      "reviewer": "zoey luke",
      "rating": " \u2605\u2605\u2605\u2605\u00bd ",
      "review": "I love natalie Portman and I hate the government"
    },...
  ]
}
}

List Object

from letterboxdpy.list import List
list_instance = List("hepburnluv", "classic-movies-for-beginners")
print(list_instance)
Click to expand List object response
{
  "scraper": {...},
  "url": "https://letterboxd.com/hepburnluv/list/classic-movies-for-beginners",
  "slug": "classic-movies-for-beginners",
  "username": "hepburnluv",
  "list_type": "list",
  "items_per_page": 60,
  "title": "classic movies for beginners.",
  "description": "old hollywood classic movies for you who wanna start watching. \u02d6\u207a\u2027\u208a\u02da \u2661 \u02da\u208a\u2027\u207a\u02d6. \u0741\u208a \u22b9 . \u0741(from easiest to hardest to watch) (these are my personal recommendations only) thank you guys for all the comments and likes <3",
  "movies": [
    [
      "The Wizard of Oz",
      "the-wizard-of-oz-1939"
    ],
    [
      "Roman Holiday",
      "roman-holiday"
    ],...
  ],
  "count": 66
}

Search Object

from letterboxdpy.search import Search
search_instance = Search("V for Vendetta", 'films')
print(search_instance.get_results(max=5))
Click to expand Search object response
{
  "available": true,
  "query": "V%20for%20Vendetta",
  "filter": "films",
  "end_page": 13,
  "count": 5,
  "results": [
    {
      "no": 1,
      "page": 1,
      "type": "film",
      "slug": "v-for-vendetta",
      "name": "V for Vendetta",
      "year": 2005,
      "url": "https://letterboxd.com/film/v-for-vendetta/",
      "poster": null,
      "directors": [
        {
          "name": "James McTeigue",
          "slug": "james-mcteigue",
          "url": "https://letterboxd.com/director/james-mcteigue/"
        }
      ]
    },
    {
      "no": 2,
      "page": 1,
      "type": "film",
      "slug": "lady-vengeance",
      "name": "Lady Vengeance",
      "year": 2005,
      "url": "https://letterboxd.com/film/lady-vengeance/",
      "poster": null,
      "directors": [
        {
          "name": "Park Chan-wook",
          "slug": "park-chan-wook",
          "url": "https://letterboxd.com/director/park-chan-wook/"
        }
      ]
    },...
  ]
}

Members Object

To be documented.

Stargazers over time

Stargazers over time

letterboxdpy's People

Contributors

besweets avatar dgw avatar fastfingertips avatar ibnaleem avatar jmcruz14 avatar nmcassa avatar pedromdpereira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

letterboxdpy's Issues

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.

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

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

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.

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()

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.

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!!

user.py line 183

        ret[genre] = [int(s) for s in data.split() if s.isdigit()][0]

It gives an error with my user (maybe because I didn't see any western movie)

I suggest replacing it by:
digit_list = [int(s) for s in data.split() if s.isdigit()]
if digit_list:
ret[genre] = digit_list[0]
else:
ret[genre] = 0

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.