V
V
Vlad2422018-12-22 22:49:04
Python
Vlad242, 2018-12-22 22:49:04

Why doesn't it display the movie title in parsing?

Why doesn't the console show movie titles? but writes None

import requests
from bs4 import BeautifulSoup
def trade_spiders (max_page):
    page = 1
    while page <= max_page:
        url = 'http://new-baskino.club/page/' + str(page)
        source_code = requests.get(url)
        plain_text = source_code.content
        soup = BeautifulSoup(plain_text, 'html.parser')
        for link in soup.find_all('div', attrs={"class": "posttitle"}):
            href = link.find('a')['href']
            print(href)
            title = link.string
            print(title)
        page+=1

trade_spiders(1)

5c1e952dbb57d877096695.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question