Skip to content

Commit 3935d27

Browse files
author
Shengming Yuan
committed
weibo live
1 parent 99839e9 commit 3935d27

File tree

12 files changed

+373
-7
lines changed

12 files changed

+373
-7
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/ssysm/StreamGetterV2.svg?branch=master)](https://travis-ci.org/ssysm/StreamGetterV2)
44

5-
流媒体链接抓取工具 使用Electron&NodeJS(底层Runtime) + Angular6 (UI)框架,使用GPL-V3.0许可证发行。
5+
流媒体链接抓取工具 使用Electron&NodeJS(底层Runtime) + Angular7 (UI)框架,使用GPL-V3.0许可证发行。
66

77
## 支持的流平台
88

@@ -11,6 +11,7 @@
1111
- Niconico 生放送(如何实现?[点击这里](https://blog.theeditorstudio.com/index.php/blog/niconico%E7%94%9F%E6%94%BE%E6%BA%90%E6%8A%93%E6%B5%81%E8%AF%A6%E8%A7%A3))
1212
- Hibiki Radio Station
1313
- Onsen.ag 音泉
14+
- Weibo.com 直播
1415

1516
## 使用展示
1617

src/app/app-routing.module.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { NiconicoComponent } from './components/platforms/niconico/niconico.comp
88
import { SessionComponent } from './components/session/session.component';
99
import { AboutComponent } from './components/about/about.component';
1010
import { OnsenagComponent } from './components/platforms/onsenag/onsenag.component';
11+
import { SinaLiveComponent } from './components/platforms/sina-live/sina-live.component';
1112

1213
const routes: Routes = [
1314
{
@@ -34,6 +35,10 @@ const routes: Routes = [
3435
path: 'onsenag',
3536
component: OnsenagComponent
3637
},
38+
{
39+
path: 'sina-live',
40+
component: SinaLiveComponent
41+
},
3742
{
3843
path: 'settings',
3944
children: [

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { FfmpegCommandPipe } from './pipes/ffmpeg-command.pipe';
3030
import { NiconicoComponent } from './components/platforms/niconico/niconico.component';
3131
import { AboutComponent } from './components/about/about.component';
3232
import { OnsenagComponent } from './components/platforms/onsenag/onsenag.component';
33+
import { SinaLiveComponent } from './components/platforms/sina-live/sina-live.component';
3334

3435
// AoT requires an exported function for factories
3536
export function HttpLoaderFactory(http: HttpClient) {
@@ -50,6 +51,7 @@ export function HttpLoaderFactory(http: HttpClient) {
5051
NiconicoComponent,
5152
AboutComponent,
5253
OnsenagComponent,
54+
SinaLiveComponent,
5355
],
5456
imports: [
5557
BrowserModule,

src/app/components/about/about.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h1 id="streamgetter">StreamGetter</h1>
33

44
<p><img src="https://travis-ci.org/ssysm/StreamGetterV2.svg?branch=master" alt="Build Status" />
5-
流媒体链接抓取工具 使用Electron&amp;NodeJS(底层Runtime) + Angular6 (UI)框架,使用GPL-V3.0许可证发行。</p>
5+
流媒体链接抓取工具 使用Electron&amp;NodeJS(底层Runtime) + Angular7 (UI)框架,使用GPL-V3.0许可证发行。</p>
66
<hr>
77
<h3 id="">支持的流平台</h3>
88

@@ -16,6 +16,8 @@ <h3 id="">支持的流平台</h3>
1616
<li>Hibiki Radio Station</li>
1717

1818
<li>Onsen.ag 音泉</li>
19+
20+
<li>新浪微博直播</li>
1921
</ul>
2022
<hr>
2123
<div class="update">

src/app/components/particals/navbar/navbar.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<li><a [routerLink]="['/hibiki']" routerLinkActive="active">HiBiKi Radio</a></li>
1616
<li><a [routerLink]="['/onsenag']" routerLinkActive="active">音泉 onsen.ag</a></li>
1717
<li><a [routerLink]="['/niconico']" routerLinkActive="active">Niconico 生放</a></li>
18+
<li><a [routerLink]="['/sina-live']" routerLinkActive="active">新浪微博直播</a></li>
1819

1920
<li><div class="divider"></div></li>
2021
<li><a class="subheader"><i class="material-icons">settings</i>设置</a></li>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<div class="container">
2+
<h3>微博直播流获取</h3>
3+
<div class="row">
4+
<form class="col s12">
5+
<div class="row">
6+
<div class="col s12">
7+
<p>请输入节目ID</p>
8+
<span>
9+
http://live.weibo.com/show?id=
10+
</span>
11+
<div class="input-field inline">
12+
<input style="width:200px" id="showId_inline" name="showId" type="text" [(ngModel)]="showId">
13+
</div>
14+
<a class="btn" (click)="loadStreamList()">解流</a>
15+
</div>
16+
</div>
17+
</form>
18+
</div>
19+
<div class="row">
20+
<div class="col s4">
21+
<label for="uid">微博用户ID</label>
22+
<input name="uid" type="text" [(ngModel)]="uid">
23+
</div>
24+
<div class="col s4">
25+
<label for="expiresHours">保活时长(小时)</label>
26+
<input name="expiresHours" disabled class="disbaled" type="number" min="1" max="4" [(ngModel)]="expiresHours">
27+
</div>
28+
</div>
29+
<div class="row" id="table" *ngIf="showStreamListTable">
30+
<table class="responsive-table highlight striped">
31+
<thead>
32+
<tr>
33+
<th>类型</th>
34+
<th>分辨率</th>
35+
<th>链接</th>
36+
</tr>
37+
</thead>
38+
<tbody *ngFor="let item of streamList">
39+
<tr>
40+
<td>视频</td>
41+
<td>{{item.title}}</td>
42+
<td>{{item.url}}</td>
43+
</tr>
44+
</tbody>
45+
</table>
46+
</div>
47+
</div>

src/app/components/platforms/sina-live/sina-live.component.scss

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { SinaLiveComponent } from './sina-live.component';
4+
5+
describe('SinaLiveComponent', () => {
6+
let component: SinaLiveComponent;
7+
let fixture: ComponentFixture<SinaLiveComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ SinaLiveComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(SinaLiveComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { SinaLiveService } from '../../../providers/platforms/sina-live.service';
3+
import { ElectronService } from '../../../providers/electron.service';
4+
5+
@Component({
6+
selector: 'app-sina-live',
7+
templateUrl: './sina-live.component.html',
8+
styleUrls: ['./sina-live.component.scss']
9+
})
10+
export class SinaLiveComponent implements OnInit {
11+
12+
constructor(
13+
private sinaLiveService: SinaLiveService,
14+
private electronService: ElectronService
15+
) { }
16+
17+
showId = '';
18+
uid = '6778227457';
19+
expiresHours = 2;
20+
21+
streamList = [];
22+
showStreamListTable = false;
23+
24+
ngOnInit() {
25+
}
26+
27+
loadStreamList() {
28+
this.showStreamListTable = false;
29+
this.streamList = [];
30+
let queryStr = this.sinaLiveService.buildQueryString(this.showId, this.uid);
31+
let sign = this.sinaLiveService.getSign(queryStr);
32+
let uri = this.sinaLiveService.buildStreamUri();
33+
34+
this.sinaLiveService.getStream(uri)
35+
.subscribe(response => {
36+
if (response['status'] === 0) {
37+
this.electronService.remote.dialog.showMessageBox({
38+
type: 'error',
39+
message: '获取信息失败,请检查您的网络链接/流服务平台状态'
40+
});
41+
} else {
42+
this.streamList = response['stream'];
43+
this.streamList.push({
44+
title: 'RTMP',
45+
url: response['rtmp_url']
46+
});
47+
this.showStreamListTable = true;
48+
}
49+
}, err => {
50+
this.electronService.remote.dialog.showMessageBox({
51+
type: 'error',
52+
message: '获取信息失败,请检查您的网络链接/流服务平台状态'
53+
});
54+
});
55+
}
56+
57+
}

0 commit comments

Comments
 (0)