GithubHelp home page GithubHelp logo

bvalosek / showlist-austin-parser Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 34 KB

Parse the HTML from showlistaustin.com for upcoming live-music shows in Austin, TX

Home Page: https://showgoat.net

License: MIT License

JavaScript 100.00%
austin javascript sxsw

showlist-austin-parser's Introduction

Showlist Austin Parser

CircleCI

Parse the HTML from showlistaustin.com for upcoming live-music shows in Austin, TX.

Powers the ShowGOAT.net site.

This was previously austin-showlist-scraper v1

Installation

$ npm install showlist-austin-parser

Usage

The library exports a single method that will take HTML and return an ES6 Iterable of Show objects.

const parse = require('showlist-austin-parser');
const fetch = require('node-fetch');

(async () => {

  const resp = await fetch('http://showlistaustin.com');
  const html = await resp.text();

  const shows = parse(html);

  for (const show of shows) {
    console.log(show);
  }

})();

Testing

$ npm test

License

MIT

showlist-austin-parser's People

Contributors

bvalosek avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

robbywashere-zz

showlist-austin-parser's Issues

Interfacing austin-showlist-scraper

First off I would like to point out that I am a new to node and inexperienced when it comes to ES6 and babel.

Attempting to execute as instructed in your Usage docs. My end goal is to return all upcoming shows for a given day, in JSON format.

Getting an error, regenerator-runtime is not defined. I went into dist/AustinShowlistScraper.js and noticed that regenerator runtime was not explicitly defined as far as I could tell. So I went ahead and required it, which returned the following:

/node_modules/austin-showlist-scraper/dist/AustinShowlistScraper.js:11
var iterateElements = regeneratorRuntime.mark(
                                         ^
TypeError: undefined is not a function
    at Object.<anonymous> (/Users/BloomINC/Desktop/testing/node_modules/austin-showlist-scraper/dist/AustinShowlistScraper.js:11:42)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/BloomINC/Desktop/testing/app.js:5:29)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

I then required generator-runtime at the root of my build and loged the output, and when checking for differences I noticed that 'default:' supersedes .mark , so I edited dist/AustinShowlistScraper.js like so:

"use strict";

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };

var _slicedToArray = function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

var regeneratorRuntime = require("babel-runtime/regenerator");

var iterateElements = regeneratorRuntime.default.mark(

/**
 * Convert a selector and cheerio context into iterable cheerio objects
 */

After running through the chain of logs erred and repeating includes accordingly. Logs checked out:

{ default: 
   { wrap: [Function: wrap],
     isGeneratorFunction: [Function],
     mark: [Function],
     awrap: [Function],
     async: [Function],
     keys: [Function],
     values: [Function: values] },
  __esModule: true }
[Function: iterateElements]

Questions:

Is this a bug or was I interfacing improperly?

I also cannot figure out how to mimic your babel configurations during batch transpilation. This however may be a gulp-babel issue but worth noting.

Is there a better way? Do I not need to transpile the script provided in your docs given my ES5 ENV?

What might you suggest given my end goal: to return all upcoming shows for a given day, in JSON format?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.