0
votes

I'm a beginner who is trying to web scrape IMDb and obtain data for my own ratings, so I first need to log into IMDb.

But I seem to be having trouble logging in using the code below, can anyone see the problem? I suspect the login code doesn't work becuase when I try to print out my rating for a film (e.g. 7), it gives me 0 (which is not a possible rating).

import requests
from requests import get
from bs4 import BeautifulSoup

EMAIL = ''
PASSWORD = ''
session = requests.Session()

payload = {'appActionToken':'izXDj2BVRfSIj2Bkj2Bgpqij2BMI58AYu1cj3D', 'appAction':'SIGNIN', 'email':EMAIL, 'password':PASSWORD}

login = session.post('https://www.imdb.com/ap/signin', data=payload)

url = ''
response = session.get(url)

soup = BeautifulSoup(response.text, 'html.parser')
# print(soup)
Instead of defining your username and password as variables and then plugging them when defining payload, have you tried directly using the email and password as strings in place of where you called the EMAIL and PASSWORD variables?Pokebab
Yes, I have. The result is the same.Jason Wang