Skip to content

Instantly share code, notes, and snippets.

View phenomnomnominal's full-sized avatar
🥑
Hangry

Craig Spence phenomnomnominal

🥑
Hangry
View GitHub Profile
import { Component, Directive, Pipe } from '@angular/core';
import { DatePipe as date, NgIf as ngIf } from '@angular/common';
import { SomethingComponent as something } from './something.component';
const template = function (templates: TemplateStringsArray, ...declarations: Array<Component | Directive | Pipe>) {
return function () {
// ivyMagicHere?!
};
}
const request = require('request').defaults({ jar: true});
const nodemailer = require('nodemailer');
const LOCATIONS = {
STOCKHOLM: 'Z209',
GÖTEBORG: 'Z102',
MALMÖ: 'KCMA',
TILLSTÅNDSPRÖVNING: 'BBBO',
BORLÄNGE: 'NHL',
JÖNKÖPING: 'Z085',
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.SENDER_EMAIL,
pass: process.env.SENDER_PASSWORD
}
});
const LOCATIONS = { /* ... */ };
const LOCATION_NAMES = Object.keys(LOCATIONS);
const ALL_APPOINTMENTS = {};
console.log('🇸🇪💉 Info: Starting loop!');
let index = 0;
setInterval(() => {
getAppointmentsForLocation(LOCATION_NAMES[index]);
if (index === LOCATION_NAMES.length - 1) {
const request = require('request').defaults({ jar: true});
const LOCATIONS = { /* ... */ };
const PAGE_REGEXP = /(\d+-\d+)\.IBehaviorListener/;
const URL_ROOT = 'https://www.migrationsverket.se/ansokanbokning/';
function getAppointmentsForLocation (location) {
const bookingPageUrl = `valjtyp?sprak=en&bokningstyp=2&enhet=${LOCATIONS[location]}&sokande=1`;
request(`${URL_ROOT}${bookingPageUrl}`, (_, _, body) => {
const LOCATIONS = {
STOCKHOLM: 'Z209',
GÖTEBORG: 'Z102',
MALMÖ: 'KCMA',
TILLSTÅNDSPRÖVNING: 'BBBO',
BORLÄNGE: 'NHL',
JÖNKÖPING: 'Z085',
NORRKÖPING: 'Z083',
SUNDSVALL: 'BBSU',
UMEÅ: 'BBUM',
const request = require('request');
const URL = 'https://www.migrationsverket.se/ansokanbokning/valjtyp?sprak=sv&bokningstyp=2&enhet=Z209&sokande=2';
request(URL, function (err, _, body) {
console.log(body);
});
$svjq('#bokaSubmit').click(function(e){
var paramStr = "";
var myHistoryArr = inlotsning.history.split(',');
for(var i = 1; i < myHistoryArr.length; i++) {
var arr = myHistoryArr[i].split(':');
paramStr = paramStr + "&"+ arr[0] +"="+ arr[1] +"";
}
window.location = "/ansokanbokning/valjtyp?sprak=sv"+ paramStr +"";
});
HOST: https://www.migrationsverket.se
PAGE: /ansokanbokning/wicket/page
QUERY PARAMS:
?4-1.IBehaviorListener.1-form-kalender-kalender
&start=2019-07-08T00%3A00%3A00%2B00%3A00
&end=2019-07-15T00%3A00%3A00%2B00%3A00
&_=1561072933552
const request = require('request');
const HOST = 'https://www.migrationsverket.se/ansokanbokning/wicket/';
const API = 'page?6-1.IBehaviorListener.1-form-kalender-kalender&start=2019-08-19&end=2019-08-26&_=1561069474473';
request(`${HOST}${API}`, function (err, _, body) {
console.log(body);
});