Skip to content

Instantly share code, notes, and snippets.

View BetterProgramming's full-sized avatar

BetterProgramming

View GitHub Profile
item_links = response.css('.large > .detailsLink::attr(href)').extract()
for a in item_links:
yield scrapy.Request(a, callback=self.parse_detail_page)
import scrapy
class OlxItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
class OlxItem(scrapy.Item):
# define the fields for your item here like:
title = scrapy.Field()
price = scrapy.Field()
url = scrapy.Field()
import ReactMapboxGl, { Layer, Feature } from "react-mapbox-gl";
const Map = ReactMapboxGl({
accessToken: "pk.eyJ1IjoiZmFicmljOCIsImEiOiJjaWc5aTV1ZzUwMDJwdzJrb2w0dXRmc2d0In0.p6GGlfyV-WksaDV_KdN27A"
});
// in render()
<Map
style="mapbox://styles/mapbox/streets-v9"
import { lineString, along, lineDistance } from '@turf/turf';
const OPTIONS = { units: 'feet' };
// 30.1 seconds, the .1 is to allow a buffer for the next set of cords to load
// I know it's not exact, but it's close :)
const STEPS = 30100;
//inside component function
useEffect(() => {
let arc = [];
return (
<Marker coordinates={currentLocation} anchor="center">
<div className="pulsating-circle" />;
</Marker>
);
export function chunk(arr, size) {
const R = [];
for (var i = 0, len = arr.length; i < len; i += size)
R.push(arr.slice(i, i + size));
return R;
}
export class ArrayUtils {
static chunk<T>(array: T[], chunkSize: number): T[][] {
const chunks: T[] = [];
let index = 0;
while(index < array.length){
chunks.push(array.slice(index, index + chunkSize);
index += chunkSize
}
return chunks;
pip install beautifulsoup
pip install apscheduler
# scrape.py
import os
import requests
from BeautifulSoup import BeautifulSoup
from apscheduler.schedulers.blocking import BlockingScheduler
from datetime import datetime
sch = BlockingScheduler()
def main():
url = 'https://www.indeed.com/jobs?q=web%20developer&l=Denver%2C%20CO&vjk=0c0f7c56b3d79b4c'
response = requests.get(url)