Skip to content

Instantly share code, notes, and snippets.

@jem-computer
Created November 14, 2015 01:54
Show Gist options
  • Save jem-computer/a7e306d803af52db49ab to your computer and use it in GitHub Desktop.
Save jem-computer/a7e306d803af52db49ab to your computer and use it in GitHub Desktop.
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