Skip to content

Commit

Permalink
Fix quantity remaining in ticket-info.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Dalimil committed May 18, 2017
1 parent 2f360a9 commit f01d469
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This script allows you to find all information about Eventbrite event tickets in

This bot is intended to be run a short time (e.g. 10s) before Eventbrite event tickets are released (use the `ticket-info.js` script described above to find the ticket release time). Its main purpose is to secure tickets for events which are sold out very quickly.

**Run this script only a short time before the tickets are released because it's quite aggresive in terms of its network activity.**
**Use the startTime script option to run it only a short time before the tickets are released because it's quite aggresive in terms of its network activity.**

#### Usage
1. Open Firefox and navigate to your Eventbrite event
Expand All @@ -39,6 +39,6 @@ It gives you an idea of how many people are going to attend (no more tricks from

## Bugs and Issues
1. There are two types of layout for Eventbrite event pages. Both scripts only work for events whose Eventbrite page contains a big header image (see screenshots) - this is the type that you will see most often. Neither script will work for events that list tickets and prices in a table - see https://github.com/Dalimil/Eventbrite-Tools/issues/3#issuecomment-256580440.
2. Ticket-Info script used to obtain more information about ticket quantity, but it recently stopped working. Hint: this JSON item suddenly appeared in their collection: `"json_blacklist_set": ["event_tz", "event_level_info", "quantity_sold", "quantity_remaining", "request", "quantity_total", "waitlist_settings", "taxoptions"]`. Can someone figure this out? (Also see https://github.com/Dalimil/Eventbrite-Tools/issues/4)
2. Ticket-Info script used to obtain more information about ticket quantity. Eventbrite added this JSON to each ticket collection object and the fields are no longer accessible: `"json_blacklist_set": ["event_level_info", "quantity_sold", "quantity_remaining", "request", "quantity_total", "waitlist_settings"]`. Can someone figure this out? (Also see our partial workaround: https://github.com/Dalimil/Eventbrite-Tools/issues/4)

**Pull requests welcome.**
7 changes: 7 additions & 0 deletions ticket-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ function run() {
const mediator = require('mediatorjs');
const data = mediator && mediator.get('ticketOrderOptions');
if (data) {
const source = document.documentElement.innerHTML;
const quantities = source.match(/\"inventoryLevel\":[0-9]+/g).map(s => s.replace(/"inventoryLevel":/, ""));
if (quantities.length == data.collection.length) {
data.collection.forEach((item, ind) => {
item.number_of_tickets_remaining = item.number_of_tickets_remaining || quantities[ind];
});
}
const parsedInfos = parseMediatorData(data);
resultString = JSON.stringify(parsedInfos, null, 2);
if(parsedInfos.length > 1) {
Expand Down

0 comments on commit f01d469

Please sign in to comment.