dbeley/senscritiquescraper

Examples does not seems to work - AttributeError: 'NoneType' object has no attribute 'find_all'

Closed this issue ยท 2 comments

When I run pipenv run python .\examples\scr_get_topchart.py I got the following error :

INFO :: Using default URL value
INFO :: URL : https://www.senscritique.com/films/tops/top111
Traceback (most recent call last):
  File "D:\senscritiquescraper\examples\scr_get_topchart.py", line 63, in <module>
    main()
  File "D:\Senscritique\senscritiquescraper\examples\scr_get_topchart.py", line 28, in main
    topchart = Senscritique.get_topchart(url)
  File "D:\Senscritique\senscritiquescraper\senscritiquescraper\Senscritique.py", line 72, in get_topchart
    topchart = topchart_utils.get_topchart_infos(soup, category)
  File "D:\Senscritique\senscritiquescraper\senscritiquescraper\utils\topchart_utils.py", line 27, in get_topchart_infos
    rows = get_rows_from_topchart(soup)  
  File "D:\Senscritique\senscritiquescraper\senscritiquescraper\utils\topchart_utils.py", line 20, in get_rows_from_topchart
    return soup.find("ol", {"class": "elto-list"}).find_all(
AttributeError: 'NoneType' object has no attribute 'find_all'

I get this type of error no matter which script or scraper instruction I use.
Thanks in advance for your help.

dbeley commented

Hey sorry for not getting back to you earlier ๐Ÿ‘‹
Indeed you should first take a look at the help (-h) for each script in order to know which arguments to use (error management could use some work I concur)

python scr_get_topchart.py -h

For this specific script you can use the -u argument to extract a specific topchart, i.e:

python scr_get_topchart.py - u "https://old.senscritique.com/films/tops/top111"

You should have a file that looks like this:
1686738252_export_topchart_films_top111.csv
(use \t/tabulation character as CSV separator in your spreadsheet)

Be aware that senscritiquescraper is only compatible with old.senscritique.com urls.

Indeed it work, thank you !