[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-94595":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":14,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":18,"hasPages":18,"topics":9,"createdAt":9,"pushedAt":9,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":16,"starSnapshotCount":16,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},94595,"flights","AWeirdDev\u002Fflights","AWeirdDev","Fast, robust Google Flights scraper (API) for Python. (Probably)",null,"https:\u002F\u002Fgithub.com\u002FAWeirdDev\u002Fflights","Python",1856,224,13,19,0,53.36,false,"main","2026-08-24 04:01:22","\u003Cdiv align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fwww.searchapi.io\u002Fgoogle-flights-api?utm_source=github&utm_medium=sponsorship&utm_campaign=google_flights_api&utm_content=AWeirdDev_flights\">\n        \u003Cimg width=\"2560\" alt=\"searchapi-banner\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F05adb599-e875-4ed7-9498-8bc4165ce4d5\" \u002F>\n        \u003Cp>Made possible with support from SearchApi\u003C\u002Fp>\n    \u003C\u002Fa>\n\u003C\u002Fdiv>\n\n\u003Cbr \u002F>\n\n\u003Cdiv align=\"center\">\n\n# ✈️ fast-flights (v3.0)\n\nThe fast and strongly-typed Google Flights scraper (API) implemented in Python.\nBased on Base64-encoded Protobuf string.\n\n[**Documentation (v3)**](https:\u002F\u002Faweirddev.github.io\u002Fflights) • [Issues](https:\u002F\u002Fgithub.com\u002FAWeirdDev\u002Fflights\u002Fissues) • [PyPi (v3)](https:\u002F\u002Fpypi.org\u002Fproject\u002Ffast-flights)\n\n```haskell\n$ pip install fast-flights\n```\n\n\u003C\u002Fdiv>\n\n\u003Cdetails>\n    \u003Csummary>\u003Cb>What's New\u003C\u002Fb>\u003C\u002Fsummary>\n\n- `v2.0` – New (much more succinct) API, fallback support for Playwright serverless functions, and [documentation](https:\u002F\u002Faweirddev.github.io\u002Fflights)!\n- `v2.2` – Now supports **local playwright** for sending requests.\n- `v3.0rc0` – Uses JavaScript data instead.\n- `v3.0` – Polished new API! I suppose.\n\n\u003C\u002Fdetails>\n\n## At a glance\n```python\nfrom fast_flights import (\n    FlightQuery,\n    Passengers, \n    create_query, \n    get_flights\n)\n\nquery = create_query(\n    flights=[\n        FlightQuery(\n            date=\"YYYY-MM-DD\",   # change the date\n            from_airport=\"MYJ\",  # three-letter name\n            to_airport=\"TPE\",    # three-letter name\n        ),\n    ],\n    seat=\"economy\",  # business\u002Feconomy\u002Ffirst\u002Fpremium-economy\n    trip=\"one-way\",  # multi-city\u002Fone-way\u002Fround-trip\n    passengers=Passengers(adults=1),\n    language=\"zh-TW\",\n)\nres = get_flights(query)\n```\n\n## Search filters\n\n`FlightQuery` supports filters for each flight leg:\n\n```python\nflight = FlightQuery(\n    date=\"YYYY-MM-DD\",\n    from_airport=\"MYJ\",\n    to_airport=\"TPE\",\n    max_stops=1,\n    airlines=[\"JL\", \"ONEWORLD\"],\n    earliest_departure_hour=7,\n    latest_departure_hour=18,\n    earliest_arrival_hour=10,\n    latest_arrival_hour=23,\n    max_duration_minutes=720,\n    connecting_airports=[\"HND\", \"NRT\"],\n    min_layover_minutes=60,\n    max_layover_minutes=240,\n    less_emissions_only=True,\n)\n```\n\nFilters for the whole search are passed to `create_query`:\n\n```python\nquery = create_query(\n    flights=[flight],\n    currency=\"USD\",\n    max_price=1500,\n    carry_on_bags=1,\n    checked_bags=1,\n    hide_separate_and_self_transfer=True,\n    exclude_basic_economy=True,\n)\n```\n\nHours use local airport time on a 0–23 clock. Duration and layover values use\nminutes, and `max_price` uses the selected `currency`. Google currently applies\nthe first leg's airline filter to the whole search.\n\n## Integrations\nIf you'd like, you can use integrations.\n\n### Bright Data\nUse the [BrightData](https:\u002F\u002Fbrightdata.com) integration to protect your IP.\n\n```python\nfrom fast_flights.integrations import BrightData\n\nresult = get_flights(\n    ..., \n    integration=BrightData(zone=\"...\")\n)\n\n# ... same as normal queries\n```\n\n### SearchApi \u003Ckbd>Sponsored\u003C\u002Fkbd>\nIf you want better consistency and richer data, consider using [SearchApi](https:\u002F\u002Fwww.searchapi.io\u002Fgoogle-flights-api?utm_source=github&utm_medium=sponsorship&utm_campaign=google_flights_api&utm_content=AWeirdDev_flights).\n\n```python\nfrom fast_flights.integrations import SearchApi, SearchApiResult\n\nresult: SearchApiResult = get_flights(\n    ...,\n    integration=SearchApi()\n)\n\n# rich data!\nresult.flights\nresult.cheaper_alternatives\nresult.price_insights\nresult.booking_options\n...\n```\n\n## Roadmap\n- [x] Use JavaScript data instead of traditional HTML parsing\n- [x] Add support for integrations\n- [ ] Dangerously use Google's `GetShoppingResults` internal API. Get ready to get banned.\n\n## Contributing\nContributing is welcomed! A few notes though:\n1. please no ai slop. i am not reading all that.\n2. im really busy with life; im not a full-time reddit mod.\n\n***\n\n## How it's made\n\nThe other day, I was making a chat-interface-based trip recommendation app and wanted to add a feature that can search for flights available for booking. My personal choice is definitely [Google Flights](https:\u002F\u002Fflights.google.com) since Google always has the best and most organized data on the web. Therefore, I searched for APIs on Google.\n\n> 🔎 **Search** \u003Cbr \u002F>\n> google flights api\n\nThe results? Bad. It seems like they discontinued this service and it now lives in the Graveyard of Google.\n\n> \u003Csup>\u003Ca href=\"https:\u002F\u002Fduffel.com\u002Fblog\u002Fgoogle-flights-api\" target=\"_blank\">🧏‍♂️ \u003Cb>duffel.com\u003C\u002Fb>\u003C\u002Fa>\u003C\u002Fsup>\u003Cbr \u002F>\n> \u003Csup>\u003Ci>Google Flights API: How did it work & what happened to it?\u003C\u002Fi>\u003C\u002Fb>\n>\n> The Google Flights API offered developers access to aggregated airline data, including flight times, availability, and prices. Over a decade ago, Google announced the acquisition of ITA Software Inc. which it used to develop its API. **However, in 2018, Google ended access to the public-facing API and now only offers access through the QPX enterprise product**.\n\nThat's awful! I've also looked for free alternatives but their rate limits and pricing are just 😬 (not a good fit\u002Fdeal for everyone).\n\n\u003Cbr \u002F>\n\nHowever, Google Flights has their UI – [flights.google.com](https:\u002F\u002Fflights.google.com). So, maybe I could just use Developer Tools to log the requests made and just replicate all of that? Undoubtedly not! Their requests are just full of numbers and unreadable text, so that's not the solution.\n\nPerhaps, we could scrape it? I mean, Google allowed many companies like [Serpapi](https:\u002F\u002Fgoogle.com\u002Fsearch?q=serpapi) to scrape their web just pretending like nothing happened... So let's scrape our own.\n\n> 🔎 **Search** \u003Cbr \u002F>\n> google flights ~~api~~ scraper pypi\n\nExcluding the ones that are not active, I came across [hugoglvs\u002Fgoogle-flights-scraper](https:\u002F\u002Fpypi.org\u002Fproject\u002Fgoogle-flights-scraper) on Pypi. I thought to myself: \"aint no way this is the solution!\"\n\nI checked hugoglvs's code on [GitHub](https:\u002F\u002Fgithub.com\u002Fhugoglvs\u002Fgoogle-flights-scraper), and I immediately detected \"playwright,\" my worst enemy. One word can describe it well: slow. Two words? Extremely slow. What's more, it doesn't even run on the **🗻 Edge** because of configuration errors, missing libraries... etc. I could just reverse [try.playwright.tech](https:\u002F\u002Ftry.playwright.tech) and use a better environment, but that's just too risky if they added Cloudflare as an additional security barrier 😳.\n\nLife tells me to never give up. Let's just take a look at their URL params...\n\n```markdown\nhttps:\u002F\u002Fwww.google.com\u002Ftravel\u002Fflights\u002Fsearch?tfs=CBwQAhoeEgoyMDI0LTA1LTI4agcIARIDVFBFcgcIARIDTVlKGh4SCjIwMjQtMDUtMzBqBwgBEgNNWUpyBwgBEgNUUEVAAUgBcAGCAQsI____________AZgBAQ&hl=en\n```\n\n| Param | Content | My past understanding |\n|-------|---------|-----------------------|\n| hl    | en      | Sets the language.    |\n| tfs   | CBwQAhoeEgoyMDI0LTA1LTI4agcIARID… | What is this???? 🤮🤮 |\n\nI removed the `?tfs=` parameter and found out that this is the control of our request! And it looks so base64-y.\n\nIf we decode it to raw text, we can still see the dates, but we're not quite there — there's too much unwanted Unicode text.\n\nOr maybe it's some kind of a **data-storing method** Google uses? What if it's something like JSON? Let's look it up.\n\n> 🔎 **Search** \u003Cbr \u002F>\n> google's json alternative\n\n> 🐣 **Result**\u003Cbr \u002F>\n> Solution: The Power of **Protocol Buffers**\n> \n> LinkedIn turned to Protocol Buffers, often referred to as **protobuf**, a binary serialization format developed by Google. The key advantage of Protocol Buffers is its efficiency, compactness, and speed, making it significantly faster than JSON for serialization and deserialization.\n\nGotcha, Protobuf! Let's feed it to an online decoder and see how it does:\n\n> 🔎 **Search** \u003Cbr \u002F>\n> protobuf decoder\n\n> 🐣 **Result**\u003Cbr \u002F>\n> [protobuf-decoder.netlify.app](https:\u002F\u002Fprotobuf-decoder.netlify.app)\n\nI then pasted the Base64-encoded string to the decoder and no way! It DID return valid data!\n\n![annotated, Protobuf Decoder screenshot](https:\u002F\u002Fgithub.com\u002FAWeirdDev\u002Fflights\u002Fassets\u002F90096971\u002F77dfb097-f961-4494-be88-3640763dbc8c)\n\nI immediately recognized the values — that's my data, that's my query!\n\nSo, I wrote some simple Protobuf code to decode the data.\n\n```protobuf\nsyntax = \"proto3\"\n\nmessage Airport {\n    string name = 2;\n}\n\nmessage FlightInfo {\n    string date = 2;\n    Airport dep_airport = 13;\n    Airport arr_airport = 14;\n}\n\nmessage GoogleSucks {\n    repeated FlightInfo = 3;\n}\n```\n\nIt works! Now, I won't consider myself an \"experienced Protobuf developer\" but rather a complete beginner.\n\nI have no idea what I wrote but... it worked! And here it is, `fast-flights`.\n\n***\n\n\u003Cdiv align=\"center\">\n\n(c) 2024-2026 AWeirdDev, and all the awesome people\n\n\u003C\u002Fdiv>\n","这是一个基于Python的高性能Google航班信息爬虫库，用于程序化获取航班价格、时刻、中转等结构化数据。核心功能包括多航段查询、精细化筛选（如航空公司、起降时间、最大中转次数、碳排放偏好）、本地Playwright支持及Bright Data代理集成；技术上采用Protobuf编码解析与JavaScript数据提取策略，兼顾稳定性与响应速度。适用于机票比价系统、旅行规划工具、航空数据分析及自动化监控等需要实时航班数据的业务场景。",2,"2026-08-12 02:30:13","trending"]