This goes with the Traversy Media Scrapy tutorial on YouTube
pip install scrapy
const cacheName = 'v1'; | |
const cacheAssets = [ | |
'index.html', | |
'about.html', | |
'/css/style.css', | |
'/js/main.js' | |
]; | |
// Call Install Event |
import requests | |
from bs4 import BeautifulSoup | |
from csv import writer | |
response = requests.get('http://codedemos.com/sampleblog/') | |
soup = BeautifulSoup(response.text, 'html.parser') | |
posts = soup.find_all(class_='post-preview') |
const express = require('express'); | |
const fetch = require('node-fetch'); | |
const redis = require('redis'); | |
const PORT = process.env.PORT || 5000; | |
const REDIS_PORT = process.env.REDIS_PORT || 6379; | |
const client = redis.createClient(REDIS_PORT); | |
const app = express(); |
This goes with the Traversy Media Scrapy tutorial on YouTube
pip install scrapy
{ | |
"Console Log": { | |
"prefix": "cl", | |
"body": "console.log($1);", | |
"description": "Console Log" | |
}, | |
"Named Function": { | |
"prefix": "nfn", | |
"body": ["function ${1:functionName}($2) {", " $3", "}"], | |
"description": "Named Function" |
const request = require('request'); | |
const cheerio = require('cheerio'); | |
const fs = require('fs'); | |
const writeStream = fs.createWriteStream('post.csv'); | |
// Write Headers | |
writeStream.write(`Title,Link,Date \n`); | |
request('http://codedemos.com/sampleblog', (error, response, html) => { | |
if (!error && response.statusCode == 200) { |
const cacheName = 'v2'; | |
// Call Install Event | |
self.addEventListener('install', e => { | |
console.log('Service Worker: Installed'); | |
}); | |
// Call Activate Event | |
self.addEventListener('activate', e => { | |
console.log('Service Worker: Activated'); |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link rel="stylesheet" href="style.css"> | |
<title>Devtools Test</title> | |
</head> | |
<body> |
import mysql.connector | |
from mysql.connector import errorcode | |
config = { | |
'user': 'root', | |
'password': '', | |
'host': 'localhost', | |
'database': 'acme' | |
} |
[ | |
{ | |
"abbr": "AL", | |
"name": "Alabama", | |
"capital": "Montgomery", | |
"lat": "32.361538", | |
"long": "-86.279118" | |
}, | |
{ | |
"abbr": "AK", |