Created
November 14, 2015 01:54
-
-
Save jem-computer/a7e306d803af52db49ab to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Xray from 'x-ray' | |
const x = Xray() | |
import { find, whereEq } from 'ramda' | |
import { defer } from 'q' | |
const nextPage = '.pagination-custom .btn-more:nth-child(2)@href' | |
// x('https:/www.typewolf.com/open-source-web-fonts', 'div.item', ['.item-title'] | |
// // title: '.item-title a'//, | |
// // // description: x('.item-title a@href', '.section-subtitle') | |
// // // usage: x('.item-title a@href', '.item-tags', ['a'])//.paginate('.pagination-custom .btn-more:nth-child(2)') | |
// // // // image: '.dribbble-img [data-src]@data-src', | |
// )((err, data) => { | |
// // // let d = find(whereEq({'title': 'Playfair Display'}), data) | |
// console.log(data) | |
// }) | |
// .paginate('.next_page@href') | |
// .limit(3) | |
// .write('results.json') | |
// console.log(x) | |
const loadDetailPage = (font) => { | |
const deferred = defer() | |
const url = `https://www.typewolf.com/site-of-the-day/fonts/${font}` | |
x('.item-tags', | |
[['a']] | |
) | |
.paginate(nextPage) | |
(url, (err, res) => { | |
if (err) return deferred.reject(err) | |
deferred.resolve(res) | |
}) | |
return deferred.promise | |
} | |
// loadDetailPage('playfair-display') | |
module.exports = { loadDetailPage } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment