This file contains 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 { createTunnel, closeTunnel, redactUrl } = require('proxy-chain'); | |
(async () => { | |
// Select the proxy to tunnel through. Note that some proxies do not allow | |
// HTTP traffic (port 80) over the HTTP CONNECT tunnel, or might not allow connection | |
// to target on any other port than 80 (HTTP) or 443 (HTTPS). | |
// You might want to try different proxy groups. | |
const PROXY_URL = 'http://auto:<PROXY_PASSWORD>@proxy.apify.com:8000'; | |
// Target server to connect to. Here we use www.example.com and port 443 for HTTPS. |
This file contains 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 scrapy | |
import apify | |
class MySpider(scrapy.Spider): | |
name = 'apifySpider' | |
def start_requests(self): | |
urls = [ | |
'https://apify.com', | |
'https://apify.com/store', |
This file contains 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 Apify = require('apify'); | |
Apify.main(async () => { | |
const requestQueue = await Apify.openRequestQueue(); | |
await requestQueue.addRequest(new Apify.Request({ url: 'https://www.iana.org/' })); | |
const pseudoUrls = [new Apify.PseudoUrl('https://www.iana.org/[.*]')]; | |
const crawler = new Apify.PuppeteerCrawler({ | |
requestQueue, | |
handlePageFunction: async ({ request, page }) => { |
This file contains 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 Apify = require('apify'); | |
Apify.main(async () => { | |
const browser = await Apify.launchPuppeteer({ liveView: true }); | |
const page = await browser.newPage(); | |
await page.goto('https://news.ycombinator.com/'); | |
const pageTitle = await page.title(); | |
console.log(`Page loaded: ${pageTitle}`); |
This file contains 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
# Here you choose the base Docker image for the actor. Apify provides the following images: | |
# apify/actor-node-basic | |
# apify/actor-node-chrome | |
# apify/actor-node-puppeteer | |
# However, you can use any other image from Docker Hub. | |
# For more information, see https://apify.com/docs/actor#base-images | |
FROM apify/actor-node-basic | |
# Copy all files and directories from the directory to the Docker image | |
COPY . ./ |
This file contains 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 puppeteer = require('puppeteer'); | |
(async() => { | |
const proxyUrl = 'http://proxy.example.com:8000'; | |
const username = 'bob'; | |
const password = 'password123'; | |
const browser = await puppeteer.launch({ | |
args: [`--proxy-server=${proxyUrl}`], | |
headless: false, |
This file contains 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 puppeteer = require('puppeteer'); | |
const proxyChain = require('proxy-chain'); | |
(async() => { | |
const oldProxyUrl = 'http://bob:[email protected]:8000'; | |
const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl); | |
// Prints something like "http://127.0.0.1:45678" | |
console.log(newProxyUrl); |
This file contains 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 Apify = require('apify'); | |
Apify.main(async () => { | |
// Get input of your act and print it | |
const input = await Apify.getValue('INPUT'); | |
console.log('My input:'); | |
console.dir(input); | |
// Save the output | |
const output = { |