Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
wikipedia-airport-scraper
Advanced tools
Get airport codes and flight connections from Wikipedia airport pages
A small Node.js script to scrape info about airports and their destinations from Wikipedia pages. When provided with the full HTML of any airport page on the mobile version of the English language Wikipedia, it will extract:
It is left to any script that uses this to:
en.m.wikipedia.org
pages, grab responses and rate limit those requests where necessaryRight now, this script doesn't provide any way to look up basic data found on airline pages and as such can't help you to link names to codes. Sunch functionality might be added in the future.
Here's a very simple example that gets data for Brussels Airport from the wikipedia url:
import got from 'got' // Or any other package that requests a HTML page
import write from 'write' // Or any other package that writes data to a local file
import scrape from 'wikipedia-airport-scraper'
// Get the HTML from the page and pass it to the script
const data = await got('https://en.m.wikipedia.org/wiki/Brussels_Airport').then((response) => scrape(response.body))
// Write out the scraped data
const outputPath = new URL('./data.json', import.meta.url).pathname
await write(outputPath, JSON.stringify(data, null, 2))
The data (simplified to show only one airline and one destination) then looks like this:
{
"name": "Brussels Airport",
"iataCode": "BRU",
"icaoCode": "EBBR",
"coordinates": {
"latitude": 50.901389,
"longitude": 4.484444
},
"flights": [
{
"airline": {
"name": "Aegean Airlines",
"link": "Aegean_Airlines"
},
"destination": {
"shortName": "Athens",
"fullName": "Athens International Airport",
"link": "Athens_International_Airport",
"isCharter": false,
"isSeasonal": false,
"suspended": false,
"startDate": null,
"endDate": null
}
}
]
}
It's obvious but probably deserves to be said: the output of this script can only be as good as the Wikipedia page that it uses as input. YMMV.
Two different but related airlines might be mapped to the same link (and ultimately IATA code) by Wikipedia. Here's part of the output from Kansai International Airport that shows All Nippon Airways and ANA Wings with a different name but the same link, in this case serving the same route. For now, the script will not recognise this as a duplicate.
{
"flights": [
{
"airline": {
"name": "All Nippon Airways",
"link": "All_Nippon_Airways"
},
"destination": {
"shortName": "Naha",
"fullName": "Naha Airport",
"link": "Naha_Airport",
"isCharter": false,
"isSeasonal": false,
"suspended": false,
"startDate": null,
"endDate": null
}
},
{
"airline": {
"name": "ANA Wings",
"link": "All_Nippon_Airways"
},
"destination": {
"shortName": "Naha",
"fullName": "Naha Airport",
"link": "Naha_Airport",
"isCharter": false,
"isSeasonal": false,
"suspended": false,
"startDate": null,
"endDate": null
}
}
]
}
null
. Here's part of the output from Ignatyevo Airport that shows Zeya as a destination airport with no Wikipedia page to link to:{
"flights": [
{
"airline": {
"name": "Angara Airlines",
"link": "Angara_Airlines"
},
"destination": {
"shortName": "Zeya",
"fullName": null,
"link": null,
"isCharter": false,
"isSeasonal": true,
"suspended": false,
"startDate": null,
"endDate": null
}
}
]
}
FAQs
Get airport codes and flight connections from Wikipedia airport pages
The npm package wikipedia-airport-scraper receives a total of 16 weekly downloads. As such, wikipedia-airport-scraper popularity was classified as not popular.
We found that wikipedia-airport-scraper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.