Skip to content

Commit

Permalink
Add ability to get price graph values (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
krisukox authored Jul 16, 2023
1 parent 7b2bff8 commit 6a59ab9
Show file tree
Hide file tree
Showing 19 changed files with 1,030 additions and 527 deletions.
433 changes: 0 additions & 433 deletions flight_v2.go

This file was deleted.

43 changes: 0 additions & 43 deletions flight_v2_test.go

This file was deleted.

26 changes: 3 additions & 23 deletions flight.go → flights/flight.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package flights

import (
"bufio"
Expand All @@ -12,12 +12,6 @@ import (
"golang.org/x/text/currency"
)

type flight struct {
Departure string
Arrival string
Price string
}

func readLine(body *bufio.Reader) ([]byte, error) {
bytesToDecode, isPrefix, err := body.ReadLine()
if err != nil {
Expand Down Expand Up @@ -146,29 +140,15 @@ func GetFlights(
if err != nil {
return nil, err
}
req.Header.Set("authority", "www.google.com")
req.Header.Set("accept", "*/*")
req.Header.Set("accept-language", "en-US,en;q=0.9")
req.Header.Set("cache-control", "no-cache")
req.Header.Set("content-type", "application/x-www-form-urlencoded;charset=UTF-8")
req.Header.Set("cookie", "CONSENT=YES+srp.gws-20211208-0-RC2.pl+FX+371")
req.Header.Set("cookie", `CONSENT=PENDING+672`)
req.Header.Set("origin", "https://www.google.com")
req.Header.Set("pragma", "no-cache")
req.Header.Set("sec-ch-ua", "\"Google Chrome\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\"")
req.Header.Set("sec-ch-ua-arch", "\"x86\"")
req.Header.Set("sec-ch-ua-bitness", "\"64\"")
req.Header.Set("sec-ch-ua-full-version", "\"113.0.5672.92\"")
req.Header.Set("sec-ch-ua-full-version-list", "\"Google Chrome\";v=\"113.0.5672.92\", \"Chromium\";v=\"113.0.5672.92\", \"Not-A.Brand\";v=\"24.0.0.0\"")
req.Header.Set("sec-ch-ua-mobile", "?0")
req.Header.Set("sec-ch-ua-model", "")
req.Header.Set("sec-ch-ua-platform", "Linux")
req.Header.Set("sec-ch-ua-platform-version", "5.19.0")
req.Header.Set("sec-ch-ua-wow64", "?0")
req.Header.Set("sec-fetch-dest", "empty")
req.Header.Set("sec-fetch-mode", "cors")
req.Header.Set("sec-fetch-site", "same-origin")
req.Header.Set("user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36")
req.Header.Set("x-same-domain", "1")

client := http.Client{
Timeout: 30 * time.Second,
}
Expand Down
2 changes: 1 addition & 1 deletion flight_test.go → flights/flight_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package flights

import (
"testing"
Expand Down
Loading

0 comments on commit 6a59ab9

Please sign in to comment.