1
我正試圖在Capital Bikeshare網站上查看我的行程歷史數據。我必須登錄並進入旅行菜單查看數據。但我得到這個錯誤:Web Scrapping Capital Bikeshare個人行程歷史數據R
> `No encoding supplied: defaulting to UTF-8.
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘readHTMLTable’ for signature ‘"xml_document"’
這是我的代碼。
> library(httr)
> library(XML)
> handle <- handle("https://www.capitalbikeshare.com/")
> path <-"profile/trips"
> login <- list(profile_login="myemail", profile_pass ="mypassword", profile_redirect_url="https://secure.capitalbikeshare.com/profile/trips/QNURCMF2Q6")
> response <- POST(handle = handle, path = path, body = login)
> readHTMLTable(content(response))
我也使用rvest嘗試,但後來我一直得到「Error: Unknown field names: _username, _password
」的錯誤。我應該在這裏使用哪個字段?我嘗試了ID,姓名等,但仍然無法使用。
我得到這個錯誤錯誤xml2 :: url_absolute(url,x $ url):object'newurl'not found' after page <-jump_to(pgsession,newurl)' – jso1226
@ jso1226,如果你有這麼遠登錄步驟奏效。對不起,我應該更清楚了,「newurl」將成爲你希望去的頁面的網址。當我完成類似的步驟時,我必須在代碼中預先定義此URL。 – Dave2e
我不再有錯誤,它似乎是通過了,但我需要運行另一個命令?我想看看它是否會給我我應該看到的領域,如旅行信息和持續時間。所以我運行'摘要(頁面)',但它給了我一個句柄,配置,網址,後退,轉發,響應和HTML行長度,類和模式列作爲表。 – jso1226