40 lines
1.2 KiB
Racket
Executable File
40 lines
1.2 KiB
Racket
Executable File
#!/usr/bin/env racket
|
|
#lang racket
|
|
; vim: ft=racket
|
|
|
|
; __ __ __
|
|
; __/ // /_/ /___ _____ ____ _ __ ___ ____ __
|
|
; /_ _ __/ / __ `/ __ \/ __ `/ / / / / | /| / / / / /
|
|
; /_ _ __/ / /_/ / / / / /_/ / / /_/ /| |/ |/ / /_/ /
|
|
; /_//_/ /_/\__,_/_/ /_/\__, / \__,_/ |__/|__/\__,_/
|
|
; /____/
|
|
|
|
(require smol-http
|
|
"private/util.rkt")
|
|
|
|
(define HOST "fring.ccs.neu.edu")
|
|
(define ROOT-PATH "/fakebook/")
|
|
(define LOGIN-PATH "/accounts/login/")
|
|
(define DEFAULT-HDRS '((user-agent . "🦈 hash-lang-uwu crawler v1.0")
|
|
;; christo pls do not track thanks
|
|
(dnt . "1")))
|
|
|
|
(define (run-webcrawler username password)
|
|
(printf-debug "the credentials are: ~s ~s\n" username password)
|
|
(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))
|
|
|
|
(module+ main
|
|
(command-line
|
|
#:program "webcrawler"
|
|
#:once-each
|
|
[("-d") "Debug mode" (debug-mode? #t)]
|
|
#:args
|
|
(username password)
|
|
(run-webcrawler username password)))
|