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 { PlaywrightCrawler, Dataset } from 'crawlee'; | |
const maxRepoCount = 100; | |
const crawler = new PlaywrightCrawler({ | |
requestHandler: async ({ page, infiniteScroll }) => { | |
// Click the Load more button and scroll until | |
// `maxRepoCount` repositories are found. | |
console.log('Clicking and scrolling.'); | |
await infiniteScroll({ |
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 { PlaywrightCrawler } from 'crawlee'; | |
const maxRepoCount = 100; | |
const crawler = new PlaywrightCrawler({ | |
requestHandler: async ({ page, infiniteScroll }) => { | |
// Click the Load more button and scroll until | |
// `maxRepoCount` repositories are found. | |
console.log('Clicking and scrolling.'); | |
await infiniteScroll({ |
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 { PlaywrightCrawler } from 'crawlee'; | |
const crawler = new PlaywrightCrawler({ | |
requestHandler: async ({ page }) => { | |
// Extract data from the page. Selecting all 'article' elements | |
// will return all the repository cards we're looking for. | |
const repos = await page.$$eval('article.border', (repoCards) => { | |
return repoCards.map(card => { | |
const [user, repo] = card.querySelectorAll('h3 a'); | |
const stars = card.querySelector('#repo-stars-counter-star').getAttribute('title'); |
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 { PlaywrightCrawler } from 'crawlee'; | |
const crawler = new PlaywrightCrawler({ | |
requestHandler: async ({ page }) => { | |
console.log(await page.title()); | |
} | |
}) | |
await crawler.run(['https://github.com/topics/javascript']); |
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 the HTML of a web page | |
const { body } = await Apify.utils.requestAsBrowser({ url: 'https://www.example.com' }); | |
console.log(body); | |
}); | |
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 the playwright library into our scraper. | |
const playwright = require('playwright'); | |
async function main() { | |
// Open a Chromium browser. We use headless: false | |
// to be able to watch what's going on. | |
const browser = await playwright.chromium.launch({ | |
headless: false, | |
}); | |
// Open a new page / tab in the browser. |
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 the playwright library into our scraper. | |
const playwright = require('playwright'); | |
async function main() { | |
// Open a Chromium browser. We use headless: false | |
// to be able to watch what's going on. | |
const browser = await playwright.chromium.launch({ | |
headless: false | |
}); | |
// Open a new page / tab in the browser. |
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 the playwright library into our scraper. | |
const playwright = require('playwright'); | |
async function main() { | |
// Open a Chromium browser. We use headless: false | |
// to be able to watch what's going on. | |
const browser = await playwright.chromium.launch({ | |
headless: false | |
}); | |
// Open a new page / tab in the browser. |
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 queue and enqueue first url. | |
const requestQueue = await Apify.openRequestQueue(); | |
const enqueueUrl = async url => requestQueue.addRequest(new Apify.Request({ url })); | |
await enqueueUrl('https://news.ycombinator.com/'); | |
const crawlerConfig = { | |
launchPuppeteerOptions: { |
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
pole = ["123", "4a5", "Ka", "5,5,1", "0,1", "15,5", "1x", "15.5", "1,"] | |
suma = 0 | |
pole.each do |item| | |
if item =~ /^\d+(,?\d+)$/ | |
nums = item.gsub(",", "") | |
nums.length.times do |i| | |
suma += nums[i].to_i | |
end |
NewerOlder