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
| FROM node:8-alpine | |
| COPY entrypoint.sh /usr/bin/entrypoint.sh | |
| # create npmrc with enviroment variable | |
| RUN echo "\$NPM_TOKEN" > /root/.npmrc | |
| # entrypoint script performs envsubst on npmrc | |
| RUN printf '#!/bin/sh\n\ | |
| sed -i "s~\$NPM_TOKEN~$NPM_TOKEN~" /root/.npmrc\n\ | |
| $@' > /usr/bin/entrypoint.sh \ |
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
| const EventEmitter = require('events') | |
| const { fromEvent } = require('rxjs') | |
| const { tap, takeUntil, mergeMap } = require('rxjs/operators') | |
| class Queuer { | |
| constructor({ maxConcurrent = 1, debug = false } = {}) { | |
| // node event emitter | |
| const queueEmitter = new EventEmitter() | |
| // event emitter to keep track of each task finishing | |
| const taskEmitter = new EventEmitter() |
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
| language: node_js | |
| stages: | |
| - test | |
| - lint | |
| cache: | |
| directories: | |
| - $HOME/.npm |
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
| import LZUTF8 from 'lzutf8' | |
| const config = { | |
| // scrape... | |
| } | |
| // on config text box input | |
| const configUrlParam = LZUTF8.compress(config, { outputEncoding: "Base64" }) | |
| history.replaceState(null, '', "?config=" + configUrlParam) |
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
| function test_package_local() { | |
| local cwd="$PWD" | |
| local package_folder=$1 | |
| cd $1 | |
| local tarball=$(npm pack) | |
| local fullpath="$package_folder/$tarball" | |
| npm install "$fullpath" | |
| cd "$cwd" | |
| } |
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
| { | |
| "input": ["username","password"], | |
| "scrape": { | |
| "download": { | |
| "urlTemplate": "http://example-site.com/login", | |
| "headers": { | |
| "username": "{username}", | |
| "password": "{password" | |
| }, | |
| "parse": { |
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
| input: 'username' | |
| defs: | |
| - name: 'home' | |
| download: 'https://ifunny.co/user/{{ username }}' | |
| parse: | |
| name: 'batch-id' | |
| selector: '.stream__item:first-child' | |
| attribute: 'data-next' | |
| - name: 'gallery' |
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
| // index.js | |
| const objectPath = Symbol("object-path"); | |
| const objectCrawler = Symbol("object-crawler"); | |
| const handler = { | |
| get: (object, prop) => { | |
| if (prop === objectPath) { | |
| return object[objectPath]; | |
| } else if (String(prop) === "Symbol(util.inspect.custom)") { | |
| return object; |
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
| import * as Rx from 'rxjs' | |
| import * as ops from 'rxjs/operators' | |
| import fs from 'fs' | |
| import VError from 'verror' | |
| /** | |
| * for now, there can only be one transport at a time | |
| * the cli will have to handle an option to directly log to terminal while also including a | |
| * "terminal ui" output default (progress bars, queued, in progress, completed, etc) | |
| * this can be accomplished by log options being done directly as command line args | |
| */ |
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
| // current design | |
| import ScrapePages from '../src' | |
| import { normalizeConfig } from '../lib/normalize-config' | |
| const config = { scrape: {} } | |
| const options = { | |
| input: { | |
| username: 'bob' | |
| }, | |
| optionsEach: { | |
| gallery: { |