new TwitchEvent(username)
Class constructor.
Parameters:
Name | Type | Description |
---|---|---|
username |
string | The twitch username. |
Methods
_extractDescription(page) → {Promise.<object>}
Internal private method used to extract description from linked event page (DOM scrapping).
Parameters:
Name | Type | Description |
---|---|---|
page |
Page | Representing puppeteer page instance. |
Returns:
Representing the event description.
- Type
- Promise.<object>
_extractEvents(page, offset) → {Promise.<object>}
Internal private method used to extract events from "virtual page" (DOM scrapping).
Parameters:
Name | Type | Description |
---|---|---|
page |
Page | Representing puppeteer page instance. |
offset |
null | number | Representing the number of events needed. |
Returns:
- Representing events extract from events page.
- Type
- Promise.<object>
(async) _getDescriptions(browser, events) → {Array.<object>}
Internal private async method used to assign description for each event.
Parameters:
Name | Type | Description |
---|---|---|
browser |
Browser | Representing the puppeteer browser instance. |
events |
Array.<object> | Representing the events list. |
Returns:
Representing the updated events list.
- Type
- Array.<object>
(async) _getEvents(target, offset, hasDescription) → {Array.<object>}
Internal private method used to extract needed events.
Parameters:
Name | Type | Description |
---|---|---|
target |
string | Representing the target url. |
offset |
null | number | Representing the number of events needed. |
hasDescription |
boolean | Representing the event description extraction state. |
Returns:
Representing the events list.
- Type
- Array.<object>
(async) _getPage(browser, target) → {Page}
Internal private async method used to create new page and goto targeted url.
Parameters:
Name | Type | Description |
---|---|---|
browser |
Browser | Representing the puppeteer browser instance. |
target |
string | Representing the target url. |
Returns:
Representing new page instance created by browser (puppeteer).
- Type
- Page
getGlobalEvents(hasDescriptionopt) → {Array.<object>}
Method used to extract globals events from twitch user.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
hasDescription |
boolean |
<optional> |
false
|
The event description extraction state. |
Returns:
Representing the globals events list.
- Type
- Array.<object>
getPastEvents(offsetopt, hasDescriptionopt) → {Array.<object>}
Method used to extract past events from twitch user.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
offset |
null | number |
<optional> |
null
|
Representing the number of events needed. |
hasDescription |
boolean |
<optional> |
false
|
Representing the event description extraction state. |
Returns:
Representing the past events list.
- Type
- Array.<object>