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 express from "express"; | |
import cors from "cors"; | |
import multer from "multer"; | |
const app = express(); | |
//Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins | |
app.use(cors()); | |
const storage = multer.diskStorage({ |
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
let allShareButtons = document.getElementsByClassName('share'); | |
for (let currentItem = 0; currentItem < allShareButtons.length; currentItem++) { | |
allShareButtons[currentItem].click(); | |
console.log(`Next item ${currentItem}`); | |
} |
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
wget --mirror \ | |
--convert-links \ | |
--html-extension \ | |
--wait=2 \ | |
-o log \ | |
https://example.com/ |
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 logging | |
import asyncio | |
from asyncio import Queue, Event, QueueEmpty | |
import aiohttp | |
async def func_worker(taskq, shutdown_signal): | |
print('worker: started working') | |
while True: |
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
pip install git+https://github.com/scrapy/scrapyd.git@python3-wip |
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 main(splash) | |
local url = splash.args.url | |
splash:set_user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36") | |
local host = 'host' | |
local port = port | |
local user = nil | |
local password = nil | |
splash:on_request(function (request) | |
request:set_proxy{host, port, username=user, password=password} | |
end) |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# A spider example on using reactor.callLater() | |
# for delays and repetition. | |
# scrapy 0.24 | |
import scrapy | |
from twisted.internet import reactor, defer |
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
# If you have faced the error on MacOS X, here's the quick fix - add these lines to your ~/.bash_profile: | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 |
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 celery.schedules import crontab | |
from flask.ext.celery import Celery | |
CELERYBEAT_SCHEDULE = { | |
# executes every night at 4:15 | |
'every-night': { | |
'task': 'user.checkaccounts', | |
'schedule': crontab(hour=4, minute=20) | |
} | |
} |
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 scrapy import Spider, Item, Field | |
from twisted.internet import defer, reactor | |
class MyItem(Item): | |
url = Field() | |
class MySpider(Spider): |
NewerOlder