人 对不起,我无法找到一些合法且有效的例子,如何从动态页面中提取xhr,json数据。事情是我必须首先登录,我成功了但现在我必须提取页面不断加载的数据。这是我现在的代码
import json, requests
from bs4 import BeautifulSoup
import urllib2
import cookielib
from lxml import html
def collect():
url = url
cj = cookielib.CookieJar()
br = mechanize.Browser()
br.set_cookiejar(cj)
br.set_handle_robots(False)
br.open(url)
br.select_form(nr=0)
br.form['username'] = 'username'
br.form['password'] = 'pass'
br.submit()
print br.response().read()
`