小编Raf*_*man的帖子

Python Web Crawler不打印任何结果

我试图在Python中创建一个简单的Web爬虫,当我运行它时,它没有显示任何错误,但它也没有按预期打印任何结果.我把目前的代码放在下面,有人可以指点我的方向吗?

import requests
from bs4 import BeautifulSoup

def stepashka_spider(max_pages):
    page = 1
    while page <= max_pages:
        url = "http://online.stepashka.com/filmy/#/page/" + str(page)
        source_code = requests.get(url)
        plain_text = source_code.text
        soup = BeautifulSoup(plain_text)
        for resoult in soup.findAll("a", {"class": "video-title"}):
            href = resoult.get(href)
            print(href)
        page += 1

stepashka_spider(1)
Run Code Online (Sandbox Code Playgroud)

python web-crawler

2
推荐指数
1
解决办法
127
查看次数

标签 统计

python ×1

web-crawler ×1