2020-04-10 20:31:41 +00:00
|
|
|
#!/usr/bin/env racket
|
2020-04-10 23:12:50 +00:00
|
|
|
#lang racket
|
|
|
|
; vim: ft=racket
|
2020-04-10 20:36:38 +00:00
|
|
|
|
2020-04-11 04:32:34 +00:00
|
|
|
; __ __ __
|
|
|
|
; __/ // /_/ /___ _____ ____ _ __ ___ ____ __
|
|
|
|
; /_ _ __/ / __ `/ __ \/ __ `/ / / / / | /| / / / / /
|
|
|
|
; /_ _ __/ / /_/ / / / / /_/ / / /_/ /| |/ |/ / /_/ /
|
|
|
|
; /_//_/ /_/\__,_/_/ /_/\__, / \__,_/ |__/|__/\__,_/
|
|
|
|
; /____/
|
|
|
|
|
2020-04-11 05:09:26 +00:00
|
|
|
(require smol-http
|
|
|
|
"private/util.rkt")
|
2020-04-11 03:17:20 +00:00
|
|
|
|
2020-04-11 05:09:26 +00:00
|
|
|
(define HOST "fring.ccs.neu.edu")
|
|
|
|
(define ROOT-PATH "/fakebook/")
|
|
|
|
(define LOGIN-PATH "/accounts/login/")
|
2020-04-10 23:23:14 +00:00
|
|
|
(define DEFAULT-HDRS '((user-agent . "🦈 hash-lang-uwu crawler v1.0")
|
|
|
|
;; christo pls do not track thanks
|
|
|
|
(dnt . "1")))
|
|
|
|
|
2020-04-10 23:12:50 +00:00
|
|
|
(define (run-webcrawler username password)
|
2020-04-11 00:13:04 +00:00
|
|
|
(printf-debug "the credentials are: ~s ~s\n" username password)
|
2020-04-11 05:09:26 +00:00
|
|
|
(define req
|
|
|
|
(make-http-req 'GET LOGIN-PATH DEFAULT-HDRS))
|
|
|
|
(define sock (http-connect HOST #:headers DEFAULT-HDRS))
|
|
|
|
(define rsp (http-request sock req))
|
|
|
|
(update-cookie-jar! (current-cookie-jar) (http-msg-headers rsp))
|
|
|
|
(displayln (current-cookie-jar))
|
|
|
|
(http-close sock))
|
2020-04-10 23:12:50 +00:00
|
|
|
|
|
|
|
(module+ main
|
|
|
|
(command-line
|
|
|
|
#:program "webcrawler"
|
2020-04-11 00:13:04 +00:00
|
|
|
#:once-each
|
|
|
|
[("-d") "Debug mode" (debug-mode? #t)]
|
2020-04-10 23:12:50 +00:00
|
|
|
#:args
|
|
|
|
(username password)
|
|
|
|
(run-webcrawler username password)))
|