如何使用python抓取网站/将数据提取到数据库中? [英] How to crawl a website/extract data into database with python?

查看:21
本文介绍了如何使用python抓取网站/将数据提取到数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个网络应用程序来帮助我大学的其他学生创建他们的日程安排.为此,我需要将主时间表(一个巨大的 html 页面)以及每个课程的详细描述的链接抓取到数据库中,最好是在 python 中.另外,我需要登录才能访问数据.

I'd like to build a webapp to help other students at my university create their schedules. To do that I need to crawl the master schedules (one huge html page) as well as a link to a detailed description for each course into a database, preferably in python. Also, I need to log in to access the data.

  • 这将如何运作?
  • 我可以/应该使用哪些工具/库?
  • 有这方面的好教程吗?
  • 我如何最好地处理二进制数据(例如漂亮的 pdf)?
  • 是否已经有好的解决方案?

推荐答案

  • requests 用于下载页面.
    • 以下是如何登录网站和下载页面的示例:https://stackoverflow.com/a/8316989/311220
    • 如果您想使用强大的抓取框架,请使用 Scrapy.它也有一些很好的文档.不过,根据您的任务,这可能有点矫枉过正.

      If you want to use a powerful scraping framework there's Scrapy. It has some good documentation too. It may be a little overkill depending on your task though.

      这篇关于如何使用python抓取网站/将数据提取到数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆