I am new to Django. I am trying to access this webpage's data and store it in some database (like sqlite). But I couldn't fetch the data. I am not sure whether this task requires the use of IMDB API or if it's possible without the use of it.
This is what I have tried:
# view.py
from django.shortcuts import render
import requests
from django.http import HttpResponse
import urllib.request, json
def index(request):
r = requests.get('https://www.imdb.com/chart/top?ref_=nv_mv_250').json()
d = {'v': r}
return render(request, 'index.html', context = d)
I am getting this error by running the above code:
JSONDecodeError at /
Expecting value: line 4 column 1 (char 3)
It would be great if someone can help me out.