[英]How to scrape all events location using python and beautiful soup
我正在嘗試抓取事件發生地點的位置。
鏈接: http://www.globalbigdataconference.com/events.html
問題是我的代碼最初只返回 6 個位置,在網站中你需要點擊顯示更多才能查看更多歷史記錄。 有沒有辦法獲取所有記錄。
我的代碼:
import requests
from bs4 import BeautifulSoup
URL = "http://www.globalbigdataconference.com/events.html"
page = requests.get(URL)
soup = BeautifulSoup(page.content, 'lxml')
event_locations = soup.find_all('article', class_= 'clearfix b-m10')
for event_loc in event_locations:
print(event_loc.text)
Output:
Santa Clara
Santa Clara
Boston
Seattle
Santa Clara
Boston
我想使用腳本獲取所有位置。
根據源代碼,“顯示更多”從這種請求中獲取數據:
url: '/User/Event/EventList',
type: 'GET',
cache: false,
data: { search: search, EventStatus: EType, City: LType, StartDate: SDate, EndDate: EDate, SortColumn: sortcolumn, SortOrder: sortorder, PageNo: pageno, PageItems: PageItems },
嘗試從這個 URL 獲取數據,會更容易
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.