![image.png](https://ipfs.busy.org/ipfs/QmWZEyU85cKJKegJshCGqLdVrArpWBgtXwPmXoyyuxGnzr) ![image.png](https://ipfs.busy.org/ipfs/QmSYwbLBSwpbfVAj4BFg3ykUDmXg2nUko8HwhbRLdjYg3S) I spent a couple hours developing a bit of code because I wanted to download all of the responsive CSS templates on free-css.com. It was a very pleasant experience. Coding, scraping, so much love. ♥♥ I saved my code in a Gist in case you want to see it (or use it, or modify it): https://gist.github.com/CryptoSharon/f0face4028b6e3cd1a32e519a0ea68ac Nananananana, still scraping. ![image.png](https://ipfs.busy.org/ipfs/QmQcMn47hocgeS4V4vRD7Btpjx9enDYvVU6YFJELotMB3S) I would have run it on my server to share the big file on here, but I wasn't thinking ahead or planning to share it. Hmmm. I guess if you want it, you'll have to scrape it too? That would be mean to free-css, so much good work and we're spamming their website with scrapers. <h2>About the code</h2> I'm using a few cool libraries that I love, i.e.: cheerio, request-promise, bluebird and fs-extra. The traditional way would have been using just cheerio, request and fs, but I love promisifying everything. I also like the extra functionalities that fs.extra provides! The `fs.pathExists(path)` is wonderful. The traditional `fs` library wanted me to do some weird `fs.access(path)` thingy and then use a property of one of the various results given? Ugly solution. I also learned that Cheerio apparently doesn't have the same `.attr('href')` as jQuery. Instead, I had to run `$('a').attribs.href`. After about half an hour of trying out things in jQuery, then trying them out on Cheerio and comparing the errors and logging the results, I managed to properly grab each URL link (12 per page) to add it to the array that would be downloaded in the end. I also discovered that I can make a delayed loop with this wonderful, wonderful function! ```js const awaitForEach = async (fn, arr) => { for (const el of arr) { await fn(el) } } ``` Props to [this blogger](https://blog.lavrton.com/javascript-loops-how-to-handle-async-await-6252dd3c795) for showing me how to do that. I was doing everything functionally, but I got very sleepy, bored and tired when I got to some unexpected errors and the `getZip()` function ended up imperative. Sad ¯\\\_(ツ)_/¯, but I was getting impatient after 2 hours of coding pretty things. Another thing to note is that not all of the files are straightforwardly downloaded. Some files, when you request them, tell you that they're not available, but that there are similar files that are available. It gives you options. I had to create this tiny piece of code to handle this Error Status 300, download files and continue with the rest of the stack. ```js .catch(e => { if (e.statusCode === 300) { const $ = cheerio.load(e.error) const links = $('li a').map((i, el) => ({ zip_link: baseUrl + el.attribs.href })) downloadAllLinks(Array.from(links)) } else { console.error(e) } }) ``` I also discovered that `$().map` doesn't return an iterable array! It's like `{0: value1, 1: value2, ...randomObject}`. It has 0, 1, 2, etc., so I could basically do `Array.from(cheerioMappedArray)` and get a valid array without object thingies so that it could be iterated by my `awaitForEach()`. I explored a few other options but the normal `.map` and ramda's `map` also attach the strange object to the array. Only `Array.from` could create a shallow clone taking only the iterable properties. <h2>File size average</h2> Okay! The files are done downloading. 658 files, 1.72 GB. 1.72*1024 = 1761.28 1761.28/658 = 2.676 The average size of the zipped templates is 2.6 megabytes. Not big, not small. I hope to find a use for all of this. I would be a good [DataHoarder](https://www.reddit.com/r/DataHoarder/) if I had any money to buy HDD's and SSD's. Instead, I'll probably have to delete it in a few months to get space for other scrapes and downloads. Alrighty then, this was fun.
post_id | 66,504,561 |
---|---|
author | cryptosharon |
permlink | node-js-scraping-all-responsive-css-templates-from-https-www-free-css-com-free-css-templates |
category | programming |
json_metadata | {"format":"markdown","tags":["programming","nodejs","javascript","busy","ulog"],"links":["https:\/\/gist.github.com\/CryptoSharon\/f0face4028b6e3cd1a32e519a0ea68ac","https:\/\/blog.lavrton.com\/javascript-loops-how-to-handle-async-await-6252dd3c795","https:\/\/www.reddit.com\/r\/DataHoarder\/"],"app":"steemit\/0.1","community":"busy","image":["https:\/\/ipfs.busy.org\/ipfs\/QmWZEyU85cKJKegJshCGqLdVrArpWBgtXwPmXoyyuxGnzr"]} |
created | 2018-11-24 05:00:30 |
last_update | 2018-11-24 05:11:57 |
depth | 0 |
children | 4 |
net_rshares | 22,369,855,675,379 |
last_payout | 2018-12-01 05:00:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 10.475 SBD |
curator_payout_value | 3.220 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 3,981 |
author_reputation | 80,455,466,172,351 |
root_title | "[Node.js] Scraping all Responsive CSS Templates from https://www.free-css.com/template-categories/responsive" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
berniesanders | 0 | 848,847,206 | 0.15% | ||
nextgencrypto | 0 | 63,851,816 | 0.15% | ||
thecryptodrive | 0 | 89,165,578,725 | 15% | ||
djfjay | 0 | 3,081,418,075 | 10% | ||
tripjammer | 0 | 10,430,780,806 | 10% | ||
beanz | 0 | 17,946,506,157 | 100% | ||
twinner | 0 | 518,337,140,466 | 25% | ||
elamental | 0 | 461,007,711 | 1% | ||
anarcho-andrei | 0 | 145,757,738 | 0.9% | ||
thecyclist | 0 | 666,738,831 | 0.15% | ||
clayboyn | 0 | 4,058,931,656 | 5% | ||
thecastle | 0 | 4,133,969,873 | 10% | ||
rymlen | 0 | 6,525,545,235 | 10% | ||
busy.pay | 0 | 228,978,383,003 | 1.1% | ||
shadowmyst | 0 | 1,389,541,511 | 100% | ||
yannpoire | 0 | 184,700,888 | 10% | ||
engagement | 0 | 0 | 0.15% | ||
iflagtrash | 0 | 0 | 0.15% | ||
maximdraws | 0 | 2,205,647,459 | 10% | ||
hattaarshavin | 0 | 5,923,052,035 | 10% | ||
boynashruddin | 0 | 179,178,207 | 5% | ||
randomthoughts | 0 | 47,095,608 | 0.15% | ||
flatearth | 0 | 4,413,881,807 | 8.7% | ||
sharkface | 0 | 5,466,652,575 | 10% | ||
sames | 0 | 6,580,229,593 | 10% | ||
adamhole | 0 | 5,738,841,913 | 10% | ||
linakay | 0 | 2,278,436,078 | 10% | ||
iamenglishtv | 0 | 4,531,700,371 | 10% | ||
mericanhomestead | 0 | 4,336,088,436 | 10% | ||
iansart | 0 | 4,106,533,030 | 5% | ||
khussan | 0 | 667,961,718 | 100% | ||
ryanblue7s | 0 | 5,587,748,556 | 10% | ||
xgrosz | 0 | 5,159,847,874 | 10% | ||
reloadbeatbox | 0 | 957,686,343 | 10% | ||
yehey | 0 | 8,492,855,423 | 10% | ||
joey-cryptoboy | 0 | 4,187,779,396 | 10% | ||
roncoejr | 0 | 134,492,654,548 | 10% | ||
crimsonclad | 0 | 19,694,332,757 | 6% | ||
pibyk | 0 | 5,266,854,996 | 10% | ||
paulag | 0 | 24,391,045,460 | 10% | ||
cryptomonitor | 0 | 53,233,354 | 10% | ||
thedelegator | 0 | 0 | 0.15% | ||
mediahousent | 0 | 20,782,819,251 | 10% | ||
imredryan | 0 | 5,120,184,234 | 10% | ||
shomophoto | 0 | 887,969,075 | 10% | ||
discordiant | 0 | 1,566,200,590 | 6% | ||
cedpete389 | 0 | 1,377,420,501 | 9% | ||
allcapsonezero | 0 | 5,612,895,169 | 10% | ||
amymya | 0 | 22,996,122,609 | 50% | ||
lukakorba | 0 | 7,276,870,400 | 10% | ||
bitfook | 0 | 747,933,335 | 10% | ||
enjgold | 0 | 1,443,422,066 | 10% | ||
redrica | 0 | 205,240,016 | 0.66% | ||
avesa | 0 | 90,342,778 | 0.33% | ||
cifer | 0 | 4,430,798,989 | 30% | ||
purepinay | 0 | 86,296,730,075 | 100% | ||
coincutie | 0 | 3,659,384,787 | 10% | ||
hello.totoro | 0 | 6,670,289,357 | 10% | ||
zeugen | 0 | 104,752,781 | 10% | ||
mimy | 0 | 3,343,081,385 | 10% | ||
fbslo | 0 | 4,494,904,548 | 35% | ||
trevorpetrie | 0 | 294,582,871 | 3% | ||
diantbi | 0 | 141,479,835 | 10% | ||
akili42 | 0 | 951,723,663 | 10% | ||
carrieallen | 0 | 8,380,346,707 | 5% | ||
bebeth | 0 | 85,116,685,794 | 100% | ||
reiseamateur | 0 | 121,044,699,822 | 50% | ||
ngc | 0 | 19,185,780,016 | 0.15% | ||
dbooster | 0 | 5,503,608,402 | 10% | ||
socent | 0 | 345,903,700 | 15% | ||
eonwarped | 0 | 19,905,435,430 | 8% | ||
fotomindo | 0 | 4,938,465,891 | 10% | ||
lotto-austria | 0 | 63,719,401,754 | 50% | ||
dawnsheree | 0 | 4,291,560,820 | 50% | ||
pechichemena | 0 | 72,488,329 | 0.6% | ||
infidel1258 | 0 | 14,015,534,926 | 10% | ||
delega | 0 | 88,830,562,208 | 100% | ||
helpie | 0 | 44,091,831,511 | 3% | ||
kryptokenny | 0 | 320,608,999 | 10% | ||
markaustin | 0 | 230,977,947 | 5% | ||
mountainjewel | 0 | 232,582,303 | 0.24% | ||
gamsam | 0 | 277,146,626 | 0.09% | ||
dcardozo25 | 0 | 4,995,013,531 | 100% | ||
gandhibaba | 0 | 5,517,661,199 | 10% | ||
geekorner | 0 | 8,376,496,498 | 100% | ||
kingeazi | 0 | 527,938,765 | 50% | ||
magpielover | 0 | 94,048,478 | 100% | ||
dynamicrypto | 0 | 3,412,232,167 | 3.3% | ||
kittysilhouette | 0 | 739,392,724 | 100% | ||
grizzle | 0 | 163,700,494 | 1% | ||
lunaticpandora | 0 | 53,308,563,050 | 100% | ||
cryptotash101 | 0 | 1,542,914,704 | 8.5% | ||
silentscreamer | 0 | 444,515,422 | 1.5% | ||
jesse12 | 0 | 2,204,640,479 | 10% | ||
alejandromata | 0 | 6,842,273,315 | 100% | ||
cryptosharon | 0 | 54,757,538,908 | 100% | ||
numberofthingz | 0 | 6,642,373,522 | 10% | ||
verhp11 | 0 | 112,447,347 | 1% | ||
atomcollector | 0 | 2,659,627,186 | 20% | ||
dreamryder007 | 0 | 5,446,775,559 | 10% | ||
bestulo | 0 | 558,020,882 | 100% | ||
zipporah | 0 | 720,401,369 | 0.6% | ||
loolooasuna | 0 | 105,770,429 | 5% | ||
randumb | 0 | 4,468,600,003 | 10% | ||
ashmodz | 0 | 4,342,154,885 | 10% | ||
teruro | 0 | 563,146,012 | 100% | ||
rativiv | 0 | 5,306,504,519 | 10% | ||
ahya | 0 | 89,985,674 | 10% | ||
edgarr | 0 | 5,534,797,002 | 10% | ||
jeronimorubio | 0 | 218,725,542 | 0.6% | ||
theturtleproject | 0 | 129,120,564 | 5% | ||
greendeliverence | 0 | 5,147,365,402 | 10% | ||
truce | 0 | 17,190,594,583 | 10% | ||
hypersonic1 | 0 | 998,318,719 | 10% | ||
rawn | 0 | 6,739,528,628 | 10% | ||
mimidee74 | 0 | 1,947,117,085 | 10% | ||
jokeskay | 0 | 5,102,287,407 | 10% | ||
schlafhacking | 0 | 118,962,143,172 | 100% | ||
nomadicsoul | 0 | 104,241,795,910 | 100% | ||
derangedvisions | 0 | 130,274,748 | 0.75% | ||
pasie15 | 0 | 5,267,706,751 | 10% | ||
lordbutterfly | 0 | 1,920,252,033 | 10% | ||
julypalma | 0 | 6,225,203,432 | 10% | ||
karega | 0 | 637,018,380 | 10% | ||
joseangelvs | 0 | 757,718,122 | 100% | ||
djdarkstorm | 0 | 417,206,465 | 25% | ||
camuel | 0 | 13,918,374,474 | 25% | ||
atmospheric-haze | 0 | 3,555,558,194 | 10% | ||
recordpool | 0 | 114,132,047 | 5% | ||
samprock | 0 | 421,196,481 | 2.5% | ||
dcabellor | 0 | 29,657,492,311 | 100% | ||
solominer | 0 | 404,010,238 | 1.5% | ||
archaimusic | 0 | 118,125,036 | 10% | ||
rightwing670 | 0 | 13,874,164,855 | 10% | ||
musicvoter | 0 | 3,349,582,370 | 1% | ||
mbc-meps | 0 | 1,963,447,170 | 10% | ||
mauryis | 0 | 2,175,529,262 | 5% | ||
clubfungus | 0 | 2,735,666,305 | 5% | ||
musicvoter2 | 0 | 70,908,796 | 10% | ||
aristideschacon | 0 | 558,468,335 | 100% | ||
tea-man | 0 | 7,225,627,029 | 50% | ||
lagtv | 0 | 4,861,990,943 | 10% | ||
adam-aj | 0 | 98,654,152 | 0.5% | ||
crip-toe-joe | 0 | 361,319,861 | 5% | ||
sbi5 | 0 | 1,952,074,823 | 1% | ||
santiagolaw | 0 | 816,192,030 | 100% | ||
fl15 | 0 | 4,097,755,898 | 60% | ||
gtrodargent | 0 | 178,810,535 | 10% | ||
thewitness | 0 | 3,324,788,564 | 10% | ||
hhtb | 0 | 848,821,346 | 10% | ||
fernando.lubezki | 0 | 1,720,519,014 | 100% | ||
the.foodini | 0 | 6,191,770,750 | 10% | ||
ocdb | 0 | 19,369,201,313,051 | 36.57% | ||
steemboobs | 0 | 558,058,799 | 100% | ||
lillywilton | 0 | 569,508,880 | 20% | ||
lilcryptita | 0 | 5,229,429,317 | 10% | ||
gatillo | 0 | 3,237,471,684 | 100% | ||
see-it-feel-it | 0 | 6,352,416,322 | 10% | ||
p3dheem | 0 | 5,072,565,623 | 10% | ||
emsteemians | 0 | 101,832,514 | 10% | ||
duval904 | 0 | 971,724,169 | 10% | ||
lifenow | 0 | 2,044,270,006 | 10% | ||
blockfreak | 0 | 4,611,792,374 | 10% | ||
trevon | 0 | 18,145,001,048 | 10% | ||
hiatus | 0 | 5,053,995,184 | 10% | ||
hornetmusic | 0 | 73,115,959 | 50% | ||
lifefun | 0 | 3,661,253,972 | 10% | ||
wordofmouth | 0 | 934,585,899 | 10% | ||
steemitsarah | 0 | 120,381,200 | 10% | ||
rishhk | 0 | 70,947,547 | 15% | ||
nostosmus | 0 | 470,944,014 | 100% | ||
yes-please | 0 | 1,877,590,375 | 50% | ||
imranlouis | 0 | 369,761,668 | 10% | ||
diana.feuerberg | 0 | 147,472,008,887 | 100% | ||
cryptoxicate | 0 | 5,352,559,872 | 10% | ||
mprgraffix | 0 | 112,692,494 | 5% | ||
adamaslam | 0 | 363,039,837 | 10% | ||
steem-ua | 0 | 198,161,799,818 | 1.64% | ||
stimme | 0 | 546,548,559 | 100% | ||
theestateof.mind | 0 | 44,621,678,300 | 10% | ||
tezus | 0 | 43,854,373,708 | 10% | ||
nworb | 0 | 51,321,344,804 | 10% | ||
meshuga | 0 | 6,192,505,269 | 10% | ||
steemturbo | 0 | 4,877,879,119 | 10% | ||
stonermedal | 0 | 431,574,731 | 42% | ||
achol | 0 | 4,987,067,318 | 10% | ||
shiktou | 0 | 5,052,452,191 | 10% | ||
louisebelcher | 0 | 2,517,919,553 | 1.99% | ||
ctime | 0 | 64,838,748,159 | 3% | ||
theduskinus | 0 | 141,824,536 | 1.5% |
## <center> Este Post ha sido votado por @gatillo y curado por @bebeth para @steempress-io</center> --- <div class="pull-right"> ![https://discord.gg/AgtNh53](https://steemitimages.com/160x160/https://cdn.steemitimages.com/DQmbj4qsgp3RPznnnLEDmA3oqk5b6AekNMDxHvaGT2JkriF/SELLO%20BEBECTH%20OSCURO.png) </div> <br/> Ya que utiliza el servicio de hospedaje de WordPress de @reveur y el plugin de @steempress-io para publicar contenido en nuestro idioma, el #castellano, si deseas saber mas o formar parte, haz click en la imagen para entrar a nuestro discord. <br/> --- <center> Un proyecto del **Witness: @castellano** y **@nnnarvaez** </center>
post_id | 66,504,936 |
---|---|
author | gatillo |
permlink | re-cryptosharon-node-js-scraping-all-responsive-css-templates-from-https-www-free-css-com-free-css-templates-20181124t051500087z |
category | programming |
json_metadata | {"app":"communitybot\/1.1.0"} |
created | 2018-11-24 05:15:00 |
last_update | 2018-11-24 05:15:00 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2018-12-01 05:15:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 646 |
author_reputation | 111,629,191,115 |
root_title | "[Node.js] Scraping all Responsive CSS Templates from https://www.free-css.com/template-categories/responsive" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
Nice stuff i think i can use it for some of my projects
post_id | 66,506,082 |
---|---|
author | cryptotrader84 |
permlink | re-cryptosharon-node-js-scraping-all-responsive-css-templates-from-https-www-free-css-com-free-css-templates-20181124t055940844z |
category | programming |
json_metadata | {"app":"steemit\/0.1","tags":["programming"]} |
created | 2018-11-24 05:59:42 |
last_update | 2018-11-24 05:59:42 |
depth | 1 |
children | 0 |
net_rshares | 115,994,487,928 |
last_payout | 2018-12-01 05:59:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.054 SBD |
curator_payout_value | 0.017 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 55 |
author_reputation | 10,660,504,989,847 |
root_title | "[Node.js] Scraping all Responsive CSS Templates from https://www.free-css.com/template-categories/responsive" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
bankthecrypto | 0 | 108,866,559,952 | 100% | ||
cryptotrader84 | 0 | 6,331,284,670 | 100% | ||
mrme1984 | 0 | 796,643,306 | 100% |
You got a 36.57% upvote from @ocdb courtesy of @cryptosharon! @ocdb is a non-profit bidbot for whitelisted Steemians, current max bid is 20 SBD and the respective amount in Steem. Check our website https://thegoodwhales.io/ for the whitelist, queue and delegation info. Join our [Discord channel for more information.](https://discord.gg/k2Hu77b) If you like what @ocd does, consider voting for [ocd-witness through SteemConnect](steemconnect.com/sign/account-witness-vote?witness=ocd-witness&approve=1) or on the Steemit Witnesses page. :)
post_id | 66,508,518 |
---|---|
author | ocdb |
permlink | re-cryptosharon-node-js-scraping-all-responsive-css-templates-from-https-www-free-css-com-free-css-templates-20181124t073733763z |
category | programming |
json_metadata | {"app":"postpromoter\/1.9.3"} |
created | 2018-11-24 07:37:33 |
last_update | 2018-11-24 07:37:33 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2018-12-01 07:37:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 542 |
author_reputation | 3,405,824,162,324 |
root_title | "[Node.js] Scraping all Responsive CSS Templates from https://www.free-css.com/template-categories/responsive" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
#### Hi @cryptosharon! Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation! Your **UA** account score is currently 4.437 which ranks you at **#2104** across all Steem accounts. Your rank has dropped 19 places in the last three days (old rank 2085). In our last Algorithmic Curation Round, consisting of 212 contributions, your post is ranked at **#172**. ##### Evaluation of your UA score: * Some people are already following you, keep going! * The readers appreciate your great work! * Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score! **Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
post_id | 66,520,097 |
---|---|
author | steem-ua |
permlink | re-node-js-scraping-all-responsive-css-templates-from-https-www-free-css-com-free-css-templates-20181124t140930z |
category | programming |
json_metadata | {"app":"beem\/0.20.9"} |
created | 2018-11-24 14:09:33 |
last_update | 2018-11-24 14:09:33 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2018-12-01 14:09:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 737 |
author_reputation | 23,203,609,903,979 |
root_title | "[Node.js] Scraping all Responsive CSS Templates from https://www.free-css.com/template-categories/responsive" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |