video-parser
Advanced tools
Comparing version 1.9.3 to 2.0.0
@@ -0,1 +1,5 @@ | ||
# 2.0.0 | ||
- Add gomtv parser. ([@ignocide](https://github.com/ignocide)) | ||
# 1.9.3 | ||
@@ -2,0 +6,0 @@ |
@@ -158,2 +158,9 @@ /** | ||
index: 8 | ||
}, | ||
{ | ||
// http://www.gomtv.com/14683612 | ||
provider: 'gomtv', | ||
pattern: /(https?:\/\/)?\/\/(www.)?gomtv.com\/(\w+)/, | ||
method: 'loadGomTv', | ||
index: 3 | ||
} | ||
@@ -327,2 +334,10 @@ ] | ||
Parser.prototype.loadGomTv = function (cb, id) { | ||
var self = this | ||
this.load(cb, function (Cb) { | ||
self.requestGomTv(cb, id) | ||
}, 'gomtv_' + id) | ||
} | ||
Parser.prototype.requestYoutube = function (cb, id) { | ||
@@ -1008,2 +1023,64 @@ var self = this | ||
Parser.prototype.requestGomTv = function (cb, id) { | ||
request('http://www.gomtv.com/' + id, function (err, res, body) { | ||
if (err) { | ||
return cb(err) | ||
} | ||
var $ = cheerio.load(body) | ||
var $meta = $('head meta') | ||
var meta = {} | ||
$meta.each(function (idx, elem) { | ||
var $elem = $(elem) | ||
var property = $elem.attr('property') | ||
if (property) { | ||
meta[property] = $elem.attr('content') | ||
} | ||
}) | ||
var vidMeta = meta['og:video'] | ||
if (typeof vidMeta === 'undefined') { | ||
return cb('video.forbidden') | ||
} | ||
// 곰티비의 컨탠츠 성격에 따라 맞지 않을수도 있음 | ||
var parts = $('div.video_data span.bu_part') | ||
var author = {} | ||
if (parts.length === 5) { | ||
author.id = parts.eq(2).text() | ||
} | ||
var cDate = $('div span.bu_part').eq(1).text() | ||
cDate = cDate.replace(/\./gi, '') | ||
var tags = [] | ||
$('div.tag a').each(function (idx, elem) { | ||
tags.push(elem.children[0].data) | ||
}) | ||
cb(null, { | ||
id: id, | ||
url: meta['og:url'], | ||
name: meta['og:title'], | ||
desc: ($('div#video_desc').text() || '').trim(), | ||
thumb_url: meta['og:image'].replace('type=13', 'type=11'), | ||
duration: 0, | ||
ctime: moment(cDate, 'YYYYMMDD').format(), | ||
ratings: {}, | ||
tags: tags, | ||
details: { | ||
definition: '', | ||
author: author, | ||
embed: { | ||
id: vidMeta.split('&h=')[1], | ||
url: vidMeta | ||
} | ||
} | ||
}) | ||
}) | ||
} | ||
Parser.prototype.loadCache = function (cb, cacheId) { | ||
@@ -1010,0 +1087,0 @@ this._client.hget(this._config.name, cacheId, function (err, res) { |
{ | ||
"name": "video-parser", | ||
"version": "1.9.3", | ||
"version": "2.0.0", | ||
"author": { | ||
@@ -27,3 +27,4 @@ "name": "egg", | ||
"tvpot", | ||
"tudou" | ||
"tudou", | ||
"gomtv" | ||
], | ||
@@ -30,0 +31,0 @@ "license": "MIT", |
@@ -24,2 +24,3 @@ # video-parser | ||
* [tudou](http://www.tudou.com/) | ||
* [gomtv](http://www.gomtv.com/) - by [@ignocide](https://github.com/ignocide) | ||
@@ -79,3 +80,4 @@ ## Dependencies | ||
'http://tvpot.daum.net/mypot/View.do?clipid=72583600&ownerid=mRlSExWR4-Q0', | ||
'http://www.tudou.com/programs/view/uKg4c5O0YyQ/' | ||
'http://www.tudou.com/programs/view/uKg4c5O0YyQ/', | ||
'http://www.gomtv.com/14692214' | ||
] | ||
@@ -339,2 +341,25 @@ | ||
{ | ||
"id": "14692214", | ||
"url": "http://www.gomtv.com/14692214", | ||
"name": "담장 넘어간 타구를 잡아 낸 아담 존스의 완벽한 슈퍼 캐치 [미국 vs 도미니카]", | ||
"desc": "2017 월드베이스볼 클래식\r\n미국 vs 도미니카 [WBC 2017]\r\n\t\t\t\t\t\t\t\r\n태그 : WBC, 월드 베이스볼 클래식", | ||
"thumb_url": "http://chi.gomtv.com/cgi-bin/imgview.cgi?nid=11433506&type=11", | ||
"duration": 0, | ||
"ctime": "2017-03-19T00:00:00+09:00", | ||
"ratings": {}, | ||
"tags": [ | ||
"WBC", | ||
"월드 베이스볼 클래식" | ||
], | ||
"details": { | ||
"definition": "", | ||
"author": {}, | ||
"embed": { | ||
"id": "2542eec85811250e10097d289b9e3248275af384060d38475176045dffe2", | ||
"url": "https://cubec.gomtv.com/player/VideoStart_v2.swf?sharemode=true&disablePopup=true&autoplay=false&h=2542eec85811250e10097d289b9e3248275af384060d38475176045dffe2" | ||
} | ||
}, | ||
"provider": "gomtv" | ||
} | ||
``` | ||
@@ -341,0 +366,0 @@ |
@@ -98,2 +98,7 @@ 'use strict' | ||
// 'http://www.tudou.com/v/hCgJVRch33w/&bid=05&rpid=993090858&resourceId=993090858_05_05_99/v.swf' | ||
// gomtv | ||
// 'http://www.gomtv.com/14692214', | ||
// 'http://www.gomtv.com/14683612', | ||
// 'http://www.gomtv.com/14692650' | ||
] | ||
@@ -100,0 +105,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52958
1159
373