이 리포지토리는 Google Flights에서 항공편 데이터를 추출하는 두 가지 방법을 제공합니다:
- 무료 Google Flights Scraper: 소규모 추출에 적합합니다
- Google Flights Scraper API: 무제한 리クエスト로 대용량 실시간 데이터 추출을 위해 설계되었습니다. Bright Data의 SERP Scraping API의 일부입니다.
Google Flights에서 제한된 데이터 추출을 위한 빠르고 간단한 스크레이핑 도구입니다.
- Python 3.9+
- 브라우저 자동화를 위한 Playwright
pip install playwright
playwright install chromiumWeb스크레이핑이 처음이신가요? Python으로 Web스크레이핑 시작하기 가이드를 확인해 보시기 바랍니다.
- google-flights-scraper.py를 여십시오.
- 다음 변수를 업데이트하십시오:
url: Google Flights URL을 붙여 넣으십시오(일반적으로tfs를 포함합니다).
- 스크립트를 실행하십시오.
💡 Pro Tip: HEADLESS = False로 설정하면 Google의 anti-scraping 조치에 의한 탐지를 최소화할 수 있습니다.
{
"airline": "Emirates",
"departure_time": "4:15 AM",
"arrival_time": "2:00 PM",
"duration": "22 hr 15 min",
"stops": "1 stop in DXB",
"price": "$1,139",
"co2_emissions": "1,092 kg CO2e",
"emissions_variation": "+6% emissions"
}무료 Scraper에는 몇 가지 제약이 있습니다:
- IP 차단 위험이 높습니다
- 리クエスト 볼륨이 제한적입니다
- CAPTCHA가 자주 발생합니다
- 프로덕션 용도로는 신뢰성이 낮습니다
이러한 제한 없이 견고하고 확장 가능한 스크레이핑을 위해서는 아래의 Bright Data 전용 API를 고려해 보시기 바랍니다. 👇
Bright Data의 Google Flights Scraper API는 SERP Scraping API에 통합되어 있으며, 광범위한 프록시 network를 활용하여 CAPTCHA나 IP 차단 없이 가격, 일정, 항공사 상세 정보를 포함한 실시간 항공편 데이터를 대규모로 추출합니다.
- 글로벌 정확도: 특정 위치에 맞춘 결과를 제공합니다
- 성공 기반 과금(Pay-Per-Success): 성공한 리クエスト에 대해서만 비용이 청구됩니다
- 실시간 데이터: 최신 항공편 데이터를 몇 초 만에 가져옵니다
- 무제한 확장성: 대용량 스크레이핑을 손쉽게 처리합니다
- 비용 효율적: 비용이 큰 인프라 필요성을 제거합니다
- 신뢰할 수 있는 성능: 내장된 anti-blocking 기술을 제공합니다
- 24/7 전문가 지원: 필요 시 언제든지 지원을 받을 수 있습니다
- Bright Data 계정 생성 (신규 사용자는 $5 크레딧을 받습니다).
- API key를 생성하십시오.
- 단계별 가이드를 따라 SERP API를 구성하고 자격 증명을 설정하십시오.
API 엔드포인트로 직접 리クエ스트를 보내십시오.
cURL Example:
curl https://api.brightdata.com/request \
-H "Content-Type: application/json" \
-H "Authorization: Bearer API_TOKEN" \
-d '{
"zone": "ZONE_NAME",
"url": "https://www.google.com/travel/flights/search?tfs=CBwQAhojEgoyMDI1LTA0LTAxagcIARIDREVMcgwIAxIIL20vMDRqcGxAAUgBcAGCAQsI____________AZgBAg",
"format": "raw"
}'Python Example:
import requests
url = "https://api.brightdata.com/request"
headers = {"Content-Type": "application/json", "Authorization": "Bearer API_TOKEN"}
payload = {
"zone": "ZONE_NAME",
"url": "https://www.google.com/travel/flights/search?tfs=CBwQAhojEgoyMDI1LTA0LTAxagcIARIDREVMcgwIAxIIL20vMDRqcGxAAUgBcAGCAQsI____________AZgBAg",
"format": "raw",
}
response = requests.post(url, headers=headers, json=payload)
with open("google-flights-data.html", "w", encoding="utf-8") as file:
file.write(response.text)
print("HTML response saved to 'google-flights-data.html'.")대신 Bright Data의 프록시 라우팅 방식을 사용할 수 있습니다.
cURL Example:
curl -i \
--proxy brd.superproxy.io:33335 \
--proxy-user "brd-customer-<customer-id>-zone-<zone-name>:<zone-password>" \
-k \
"https://www.google.com/travel/flights/search?tfs=CBwQAhojEgoyMDI1LTA0LTAxagcIARIDREVMcgwIAxIIL20vMDRqcGxAAUgBcAGCAQsI____________AZgBAg"Python Example:
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
host = "brd.superproxy.io"
port = 33335
username = "brd-customer-<customer-id>-zone-<zone-name>"
password = "<zone-password>"
proxy_url = f"http://{username}:{password}@{host}:{port}"
proxies = {"http": proxy_url, "https": proxy_url}
url = "https://www.google.com/travel/flights/search?tfs=CBwQAhojEgoyMDI1LTA0LTAxagcIARIDREVMcgwIAxIIL20vMDRqcGxAAUgBcAGCAQsI____________AZgBAg"
response = requests.get(url, proxies=proxies, verify=False)
with open("google-flights-data.html", "w", encoding="utf-8") as file:
file.write(response.text)
print("Response saved to 'google-flights-data.html'.")Note: 프로덕션 용도에서는 SSL Certificate Guide에 따라 Bright Data의 SSL 인증서를 로드하십시오.
다음 선택적 파라미터로 Google Flights 데이터 추출을 세밀하게 조정할 수 있습니다.
위치 및 언어에 따라 검색 결과를 사용자 지정하십시오:
| Parameter | Description | Example |
|---|---|---|
| gl | 두 글자 국가 코드 | gl=us (United States) |
| hl | 두 글자 언어 코드 | hl=en (English) |
Example: 프랑스어로 파리에서 런던으로 가는 항공편을 검색하십시오:
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
"https://www.google.com/travel/flights/search?tfs=CBwQAhojEgoyMDI1LTA0LTAxagcIARIDQ0RHcgwIAxIIL20vMDRqcGxAAUgBcAGCAQsI____________AZgBAg&hl=fr&gl=fr"curr 파라미터를 사용하여 반환되는 가격의 통화를 정의하십시오.
Example: 가격을 USD로 반환합니다.
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer-id>-zone-<zone-name>:<zone-password> \
"https://www.google.com/travel/flights/search?tfs=CBwQAhojEgoyMDI1LTA0LTAxagcIARIDQ0RHcgwIAxIIL20vMDRqcGxAAUgBcAGCAQsI____________AZgBAg&hl=fr&gl=fr&curr=USD"- Docs: SERP API Documentation
- Related APIs: Web Unlocker API, SERP API, Google Search API, Google News Scraper, Google Trends API, Google Reviews API, Google Hotels API
- Google 스크레이핑 튜토리얼:
- Use Cases:
- Additional Reading: Best SERP APIs
- Contact Support: support@brightdata.com



