Menu
Portfolio
Blog
Snippets
Login
Confirm
exit_to_app
Close
Entries
library_add
Utility(Event,Mouse): Log Movement X,Y
delete
Utility(txt): Basic Sentence Generator
delete
Utility(Event,Keyboard): Logger
delete
Utility(txt): Expanded Phrase Generator
delete
Scrape(General|Multi): Paginated Crawler
delete
Scrape(Sunbiz|Multi): Get Biz's By Zip
delete
Utility(Time): Test Load Speed
delete
Scrape(General|Single|NLP): Get Keyword Stats
delete
Scrape(General|Single): Get Text Near Links
delete
Utility(Event|Mouse): Press Down,Up, & Dragend
delete
Utility(Number): Between Range
delete
Utility(Event|Window): On Resize
delete
Scrape(Youtube|Single): Crawl Channel Videos
delete
Scrape(General|Multi): Tiny Link Crawler
delete
Utility(Time): Day of Week Report
delete
Utility(Number): Aspect Ratio Size Pairs
delete
Utility(Data): Sort Object Properties
delete
Scrape(General|Single): RiTa Sentences & Words
delete
Scrape(General|Single): Investigate Element Layers
delete
Scrape(NLP|Single): Using Compromise Plugins
delete
Utility(General): Remote Script Loader
delete
Scrape(General|Single|NLP): Compromise RiTa D3
delete
Scrape(General|Multi|Node): Grouped Node Crawler
delete
Scrape(Amazon|Multi): Crawl Product SERPs
delete
Scrape(Amazon|Multi): Get Paginated Brands
delete
Utility (Data): Download JSON in Browser
delete
Utility (Data): JSON AutoTypes
delete
Scrape(YouTube|Single): Video Page
delete
Utility (Text): Make Page Editable
delete
Utility (Text): Article Editor
delete
Scrape(General|Single|Text): Get Text On Click
delete
Utility (File): DnD File Parser (CSV,JSON,TXT)
delete
Scrape(General|Single): Get Links (Examples)
delete
Scrape(General|Single|Text): Get Sentences by Tag
delete
Utility (File): JSON to CSV via D3.js
delete
Scrape(General|Single): Auto Parse by Content Type
delete
Scrape(General|Single): Get Paragraphs & Sentences
delete
Scrape(Amazon|Multi): Get Reviews by ASIN
delete
Scrape(General|Single): Download Images on Page
delete
Utility(Event,Form): Custom Submit Function
delete
Utility (Fetch): Basic API Post Request
delete
Utility (Event,Form,Fetch): Form Data to API
delete
Utility (Time): Async Delay
delete
Utility (Time): Async Repeat Every N Secs
delete
Scrape(coj): Crawl Property SERPs
delete
Utility (Data): Promise Chain
delete
Utility (Fetch): Examples - JSON,Text,HTML
delete
Scrape(Amazon|Single): Product Review NLP
delete
Utility (Nodejs): Streaming Collections
delete
Scrape(Rate My Professor|Multi): Crawl Prof SERPs
delete
Utility (Time): JS Timer
delete
Utility (Text): Proper Case
delete
Scrape(Thingiverse API): Get Things via Search API
delete
Scrape(General|Single|Node): Get Node Attributes
delete
Scrape(General|Single|Node): Node Attributes + Text
delete
Scrape(Thesaurus): Get Words from SERPs
delete
Scrape(Walmart): Crawl Product SERPs
delete
Scrape(free3d): Crawl 3D Model SERPs
delete
Scrape(Aliexpress|Single): Get Products From SERP
delete
Scrape(simplify3d): Crawl Post SERPs
delete
Scrape(Twitter): Crawl Post Feed (infinite scroll)
delete
Scrape(DDuckGo|Single): Get Links from SERP
delete
Scrape(General|Single): Get Tokens String Distance
delete
Scrape(General|Single): Content Report
delete
Scrape(General|Single|Node): Node Recon (CSV)
delete
Utility (File): D3 JSON to CSV
delete
Scrape(coj|Multi): Crawl Property SERPs
delete
Scrape(coj|Single): sidenote
delete
Scrape(General|Single): Recursive Node Crawler
delete
Utility (Event,Window): Scroll to Root ScrollHeight
delete
Scrape(Indeed|Multi): Crawl Job SERPs
delete
Scrape(Thingiverse API): Get Things By Id
delete
Scrape(Thingiverse): Crawl Things by Category
delete
Scrape(Thingiverse API): Get Thing Batches by Id via DnD
delete
Scrape(YouTube|Single): Get Video Playlist
delete
Utility (Data): Join Thing Metrics & Meta
delete
Utility(Data): Get Nested Array Lengths
delete
Utility (Twitter): Hide Followed Profiles
delete
Utility (Time): YYYY-MM-DD HH:MM:SS
delete
Scrape(Thangs|Multi): Crawl 3D Model SERPs
delete
Scrape(PrusaPrints,Multi): Get Prints
delete
Scrape(Reddit,Single): Get Posts
delete
Userscript(Youtube): Scrape Channel Videos
delete
Userscript(Youtube): Tab Manager
delete
Scrape(Sunbiz|Multi): Biz Details
delete
Utility(Data):DnD View Types
delete
Scrape(General|Single|Node): Select Nodes by Attr
delete
Scrape(Aliexpress|Multi) Get Products via API
delete
Utility(Text): Strip Web Page CSS, Script, Events, Media
delete
Scrape(Youtube|Single) Get Subs
delete
Scrape(General|Single): SelectAll ReduceByProp
delete
Scrape(General|Single): SelectAll ReduceMultiProps
delete
Scrape(General|Multi): Tiny Link Crawler + Delay & Node Reports
delete
Scrape(P5|Multi): Get Examples
delete
Scrape(LinkedIn|Single): Find New Connections
delete
UserScript(linkedIn|Single) Get Jobs
delete
Utility (Time): Date From Days Ago
delete
Utility(General|Single) Keep Scrolling
delete
Scrape(YouTube) Videos From Search
delete
Utility(General|Single): getOffset
delete
Utility(Event,Form): Get Data On Form Input
delete
Utility(Event,Element): ResizeObserver
delete
COCO-SSD Object Categories
delete
Scrape(Wikipedia|Multi): What Links Here?
delete
Scrape(DDuckGo|Single): Download Images
delete
Scrape(General|Single|NLP): Compromise nGram
delete
Scrape(Thingiverse): Crawl Things by Category
Edit Snippet
var records = []; var uniq = new Set(); var reqTotal = 0; var categories = [ { "subcategory": "Chess", "sid": 151, "category": "Toys & Games", "cid": 72 }, { "subcategory": "Construction Toys", "sid": 121, "category": "Toys & Games", "cid": 72 }, { "subcategory": "Dice", "sid": 122, "category": "Toys & Games", "cid": 72 }, { "subcategory": "Games", "sid": 123, "category": "Toys & Games", "cid": 72 }, { "subcategory": "Mechanical Toys", "sid": 124, "category": "Toys & Games", "cid": 72 }, { "subcategory": "Playsets", "sid": 113, "category": "Toys & Games", "cid": 72 }, { "subcategory": "Puzzles", "sid": 125, "category": "Toys & Games", "cid": 72 }, { "subcategory": "Toy & Game Accessories", "sid": 149, "category": "Toys & Games", "cid": 72 }, { "subcategory": "", "sid": "", "category": "Toys & Games", "cid": 72 }, { "subcategory": "Hand Tools", "sid": 118, "category": "Tools", "cid": 71 }, { "subcategory": "Machine Tools", "sid": 117, "category": "Tools", "cid": 71 }, { "subcategory": "Tool Holders & boxes", "sid": 120, "category": "Tools", "cid": 71 }, { "subcategory": "", "sid": "", "category": "Tools", "cid": 71 }, { "subcategory": "Animals", "sid": 107, "category": "Models", "cid": 70 }, { "subcategory": "Buildings & Structures", "sid": 108, "category": "Models", "cid": 70 }, { "subcategory": "Creatures", "sid": 109, "category": "Models", "cid": 70 }, { "subcategory": "Food & Drink", "sid": 110, "category": "Models", "cid": 70 }, { "subcategory": "Model Furniture", "sid": 111, "category": "Models", "cid": 70 }, { "subcategory": "Model Robots", "sid": 115, "category": "Models", "cid": 70 }, { "subcategory": "People", "sid": 112, "category": "Models", "cid": 70 }, { "subcategory": "Props", "sid": 114, "category": "Models", "cid": 70 }, { "subcategory": "Vehicles", "sid": 116, "category": "Models", "cid": 70 }, { "subcategory": "", "sid": "", "category": "Models", "cid": 70 }, { "subcategory": "Biology", "sid": 106, "category": "Learning", "cid": 69 }, { "subcategory": "Engineering", "sid": 104, "category": "Learning", "cid": 69 }, { "subcategory": "Math", "sid": 105, "category": "Learning", "cid": 69 }, { "subcategory": "Physics & Astronomy", "sid": 148, "category": "Learning", "cid": 69 }, { "subcategory": "", "sid": "", "category": "Learning", "cid": 69 }, { "subcategory": "Bathroom", "sid": 147, "category": "Household", "cid": 67 }, { "subcategory": "Containers", "sid": 146, "category": "Household", "cid": 67 }, { "subcategory": "Decor", "sid": 97, "category": "Household", "cid": 67 }, { "subcategory": "Household Supplies", "sid": 99, "category": "Household", "cid": 67 }, { "subcategory": "Kitchen & Dining", "sid": 100, "category": "Household", "cid": 67 }, { "subcategory": "Office Organization", "sid": 101, "category": "Household", "cid": 67 }, { "subcategory": "Outdoor & Garden", "sid": 98, "category": "Household", "cid": 67 }, { "subcategory": "Pets", "sid": 103, "category": "Household", "cid": 67 }, { "subcategory": "", "sid": "", "category": "Household", "cid": 67 }, { "subcategory": "Automotive", "sid": 155, "category": "Hobby", "cid": 66 }, { "subcategory": "DIY", "sid": 93, "category": "Hobby", "cid": 66 }, { "subcategory": "Electronics", "sid": 92, "category": "Hobby", "cid": 66 }, { "subcategory": "Music", "sid": 94, "category": "Hobby", "cid": 66 }, { "subcategory": "R/C Vehicles", "sid": 95, "category": "Hobby", "cid": 66 }, { "subcategory": "Robotics", "sid": 96, "category": "Hobby", "cid": 66 }, { "subcategory": "Sport & Outdoors", "sid": 140, "category": "Hobby", "cid": 66 }, { "subcategory": "", "sid": "", "category": "Hobby", "cid": 66 }, { "subcategory": "Audio", "sid": 141, "category": "Gadgets", "cid": 65 }, { "subcategory": "Camera", "sid": 86, "category": "Gadgets", "cid": 65 }, { "subcategory": "Computer", "sid": 87, "category": "Gadgets", "cid": 65 }, { "subcategory": "Mobile Phone", "sid": 88, "category": "Gadgets", "cid": 65 }, { "subcategory": "Tablet", "sid": 90, "category": "Gadgets", "cid": 65 }, { "subcategory": "Video Games", "sid": 91, "category": "Gadgets", "cid": 65 }, { "subcategory": "", "sid": "", "category": "Gadgets", "cid": 65 }, { "subcategory": "Accessories", "sid": 81, "category": "Fashion", "cid": 64 }, { "subcategory": "Bracelets", "sid": 82, "category": "Fashion", "cid": 64 }, { "subcategory": "Costume", "sid": 142, "category": "Fashion", "cid": 64 }, { "subcategory": "Earrings", "sid": 139, "category": "Fashion", "cid": 64 }, { "subcategory": "Glasses", "sid": 83, "category": "Fashion", "cid": 64 }, { "subcategory": "Jewelry", "sid": 84, "category": "Fashion", "cid": 64 }, { "subcategory": "Keychains", "sid": 130, "category": "Fashion", "cid": 64 }, { "subcategory": "Rings", "sid": 85, "category": "Fashion", "cid": 64 }, { "subcategory": "", "sid": "", "category": "Fashion", "cid": 64 }, { "subcategory": "", "sid": "", "category": "Art", "cid": 63 }, { "subcategory": "Art Tools", "sid": 75, "category": "Art", "cid": 63 }, { "subcategory": "Coins & Badges", "sid": 143, "category": "Art", "cid": 63 }, { "subcategory": "Interactive Art", "sid": 78, "category": "Art", "cid": 63 }, { "subcategory": "Math Art", "sid": 79, "category": "Art", "cid": 63 }, { "subcategory": "Scans & Replicas", "sid": 145, "category": "Art", "cid": 63 }, { "subcategory": "Sculptures", "sid": 80, "category": "Art", "cid": 63 }, { "subcategory": "Signs & Logos", "sid": 76, "category": "Art", "cid": 63 }, { "subcategory": "2D Art", "sid": 144, "category": "Art", "cid": 63 }, { "subcategory": "3D Printer Accessories", "sid": 127, "category": "3D Printing", "cid": 73 }, { "subcategory": "3D Printer Extruders", "sid": 152, "category": "3D Printing", "cid": 73 }, { "subcategory": "3D Printer Parts", "sid": 128, "category": "3D Printing", "cid": 73 }, { "subcategory": "3D Printers", "sid": 126, "category": "3D Printing", "cid": 73 }, { "subcategory": "3D Printing Tests", "sid": 129, "category": "3D Printing", "cid": 73 }, { "subcategory": "", "sid": "", "category": "3D Printing", "cid": 73 }, { "subcategory": "", "sid": "", "category": "Other", "cid": 0 } ]; var run = async () => { var recordCount = 10000, perPage = 50, batchSize = categories.length, pageCount = Math.ceil(recordCount / perPage), batchCount = 100, requestCount = Math.ceil(pageCount / batchCount); console.log({recordCount,perPage,batchSize,batchCount}); async function* ag() { let i = 0; while (i < batchCount) { yield i++; } } var apiFetch = (cat,n) => { n++; reqTotal++; //console.log({page:n,reqTotal}); return fetch(`https://api.thingiverse.com/search/?q=&page=${n}&per_page=${perPage}&category_id=${cat}&sort=popular&type=things`, { //&posted_after=now-365d //&posted_before=now-365d "headers": { "Authorization": "Bearer 56edfc79ecf25922b98202dd79a291aa" } }) } var requestBatch = async (cat,n) => { var batch = []; for (let i = n; i < (n+batchSize); i++){ try{ batch.push(apiFetch(cat,i)); }catch(e){ console.log({e}); } } var responses = await Promise.all(batch); var collection = []; for (let res of responses){ collection.push(res.json()) } var data = await Promise.all(collection); return await data; } var downloadReport = () => { console.log({records:records.length}) records = records.reduce((a,d) => { var prev = uniq.size; uniq.add(d.id); if(prev < uniq.size){ d.tags = Array.isArray(d.tags) ? d.tags.map(tag => tag.name).join("|") : ""; var creator = {...d.creator}; d.creatorId = creator.id; d.lastname = creator.last_name; d.firstname = creator.first_name; d.creatorName = creator.name; a.push([ "id", "category", "subcategory", "creatorName", "name", "public_url", "created_at", "creatorId", "comment_count", "like_count", "tags", "lastname", "firstname" ].reduce((o,k) => ({...o, [k]:d.hasOwnProperty(k) ? k.indexOf("_count") > -1 && isNaN(d[k]) ? 0 : d[k] : ""}),{})); } return a; },[]) console.log({reduced:records.length}); downloadCSV(records,`${records[0].category}_${records[0].subcategory}`); records = []; return true; } var done = false; for await (let n of ag()) { var cat = categories[n]; if(!cat){ cat = categories[categories.length-1]; done = true; } var catId = cat.sid !== "" ? cat.sid : cat.cid; console.log("Category: "+cat.category + cat.subcategory); try{ var data = await requestBatch(catId,n); for (let d of data){ records = [...records, ...(d.hits || []).map(t => ({...t, ...cat}))]; } }catch(e){ console.log({e}); } if(catId != cat.sid || !cat.sid || cat.id == 0){ console.log("Downloading "+records.length); await downloadReport(cat.category,cat.subcategory); } if(done){ break;} } console.log("DONE") } var downloadCSV = (data, fileName) => { var d = document; var a = d.createElement('a'); var today = new Date().toISOString().slice(0,10); a.href = window.URL.createObjectURL(new Blob([d3.csvFormat(data)],{type:'text/csv;charset=utf-8;'})); a.setAttribute('download', `${fileName}-${today}.csv`); d.body.appendChild(a); a.click(); d.body.removeChild(a); records = []; }; (async () => { var options = { scripts: ["https://d3js.org/d3.v6.min.js"], } const loadScripts = ({scripts}) => { console.log(`Loading External Scripts`); var scriptCountdown = scripts.length; var loadScript = (url) => { console.log("load") var scriptsLoaded = () => scriptCountdown == 0 ? run() : null; var imported = document.createElement('script'); imported.src = url; imported.addEventListener("load", () => { scriptCountdown--; scriptsLoaded(); }); document.head.appendChild(imported); } scripts.forEach(loadScript) } loadScripts(options); })()