【发布时间】:2019-07-07 11:58:37
【问题描述】:
我必须下载 URL 链接的所有 html。但我没有收到任何 HTML 标签。相反,我只得到了这些行。
<!doctype html>
<html lang="en">
<head><meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <title></title>
<link href="/github-user-search/app.bundle.562f293b75a96de878ab.css" rel="stylesheet"></head><body>
<div id="root"></div>
<script type="text/javascript" src="/github-user-search/app.bundle.562f293b75a96de878ab.js"></script></body>
</html>
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
url ='https://simonsmith.github.io/github-user-search/#/search?per_page=42&page=1&q=Ben%20Newman'
response = requests.get(url)
print(response.content)
soup = BeautifulSoup(response.text, 'html.parser')
soup.findAll('a')
【问题讨论】:
-
你从那个页面到底想要什么?真的只是所有的html吗?
标签: html python-3.x web-scraping beautifulsoup python-requests