Last active
August 29, 2015 14:21
-
-
Save yuriteixeira/726975f720e4e5aaf22c to your computer and use it in GitHub Desktop.
Generate skyscanner search urls. To open then, copy and paste the result on openlist chrome extension (https://chrome.google.com/webstore/detail/openlist/nkpjembldfckmdchbdiclhfedcngbgnl?hl=en), like you see here: http://i.imgur.com/oCfY2Wy.jpg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Usage : | |
// php fly.php <start_date> <trip_interval> <variance> <from> <to> | |
// | |
// Eg: A 7 day trip from VIX to STOC, 30 days of variance | |
// php fly.php 2015-07-01 30 "+7 day" vix stoc | |
$start = new \DateTime("{$argv[1]}"); | |
$variance = "+{$argv[2]} day"; | |
$tripInterval = "{$argv[3]}"; | |
$from = "{$argv[4]}"; | |
$to = "{$argv[5]}"; | |
$max = clone $start; | |
$max->modify($variance); | |
$template = "http://www.skyscanner.se/transport/flights/%s/%s/%s/%s\n"; | |
while ($start->modify("+1 day")->getTimestamp() <= $max->getTimestamp()) { | |
$nextDate = clone $start; | |
$nextDate = $nextDate->modify($tripInterval); | |
printf($template, $from, $to, $start->format('ymd'), $nextDate->format('ymd')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where exactly generating skyscanner search urls is going against their terms & conditions? It doesn't do any crawling (scan), and doesn't copy, index or sort anything, since the user is going to see a regular skyscanner page hosted by skyscanner. As far as I understand, I'm creating traffic for skyscanner for free, nothing else.