Skip to content
This repository was archived by the owner on Oct 19, 2019. It is now read-only.

Commit 3bfcb34

Browse files
authored
Merge pull request #1 from OpenByteDev/typescript
Converted to Typescript
2 parents 036556f + 92fb560 commit 3bfcb34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1439
-1112
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
.idea
3-
.git
3+
.git
4+
dist
5+
types

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
.idea
3-
.git
3+
.git
4+
lib

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ language: node_js
22
node_js:
33
- "8"
44
notifications:
5-
email: false
5+
email: false
6+
script:
7+
- "npm run lint"
8+
- "npm run build"
9+
- "npm test"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Simple library which helps you to retrieve...
1414

1515
## Supported Sites
1616

17-
#### Stream
17+
#### Source
1818
- <sub><img src="http://www.google.com/s2/favicons?domain=openload.co" height="20"></sub> openload.co
1919
- <sub><img src="http://www.google.com/s2/favicons?domain=oload.tv" height="20"></sub> oload.tv
2020
- <sub><img src="http://www.google.com/s2/favicons?domain=streamcloud.eu" height="20"></sub> streamcloud.eu
@@ -23,7 +23,7 @@ Simple library which helps you to retrieve...
2323
- <sub><img src="http://www.google.com/s2/favicons?domain=streamango.com" height="20"></sub> streamango.com
2424
- <sub><img src="http://www.google.com/s2/favicons?domain=rapidvideo.com" height="20"></sub> rapidvideo.com
2525

26-
#### Link
26+
#### Hoster
2727
- <sub><img src="http://www.google.com/s2/favicons?domain=gogoanime.io" height="20"></sub> gogoanime.io
2828
- <sub><img src="http://www.google.com/s2/favicons?domain=kissanime.ru" height="20"></sub> kissanime.ru
2929
<hr>
@@ -36,7 +36,7 @@ npm install sourcescrapper
3636

3737
### Usage
3838
```js
39-
const {scrappers} = require('sourcescrapper');
39+
const { scrappers } = require('sourcescrapper');
4040

4141
(async () => {
4242
const url = 'some url';

index.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

lib/Error.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/Hoster.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

lib/Hoster.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import normalizeUrl = require('normalize-url');
2+
import objectMerge = require('object-merge');
3+
4+
const _private = new WeakMap();
5+
6+
export class Hoster {
7+
public name: string;
8+
9+
constructor({ url, name }: { url: string, name: string }) {
10+
this.url = url;
11+
this.name = name;
12+
}
13+
14+
get url(): string {
15+
return _private.get(this).url;
16+
}
17+
set url(value: string) {
18+
(_private.get(this) || _private.set(this, {}).get(this)).url = normalizeUrl(value);
19+
}
20+
21+
public toJSON(): object {
22+
return objectMerge(this, _private.get(this));
23+
}
24+
}

lib/HosterInfo.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

lib/HosterInfo.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import objectMerge = require('object-merge');
2+
3+
import { Hoster } from './Hoster';
4+
import { Info } from './Info';
5+
6+
const _private = new WeakMap();
7+
8+
export class HosterInfo extends Info {
9+
public title: string;
10+
constructor({ hoster, title }: { hoster?: Hoster[] | Hoster, title?: string } = {}) {
11+
super();
12+
13+
this.hoster = typeof hoster === 'undefined' ? [] : Array.isArray(hoster) ? hoster : [hoster];
14+
this.title = title;
15+
}
16+
17+
get hoster(): Hoster[] {
18+
return _private.get(this).hoster;
19+
}
20+
set hoster(value: Hoster[]) {
21+
(_private.get(this) || _private.set(this, {}).get(this)).hoster = value;
22+
}
23+
24+
public toJSON(): object {
25+
return objectMerge(this, _private.get(this));
26+
}
27+
}

0 commit comments

Comments
 (0)