Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

video-parser

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

video-parser - npm Package Compare versions

Comparing version 1.8.4 to 1.9.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 1.9.0
- Add tudou parser. (http://www.tudou.com/)
# 1.8.4

@@ -2,0 +6,0 @@

@@ -49,2 +49,5 @@ /**

},
tudou: {
key: ''
},
ttl: 3600 * 12 // 1 day

@@ -146,2 +149,12 @@ })

index: 6
},
{
// http://www.tudou.com/programs/view/OPvyq2gJWfY/?FR=LIAN
// http://www.tudou.com/programs/view/html5embed.action?code=kbPzDzCIeBE&autoPlay=false&playType=AUTO
// http://www.tudou.com/v/OPvyq2gJWfY/&resourceId=0_04_05_99/v.swf
// http://www.tudou.com/programs/view/html5embed.action?type=0&code=OPvyq2gJWfY&lcode=&resourceId=0_06_05_99
provider: 'tudou',
pattern: /(https?:\/\/)?\/\/(www.)?tudou.com\/((programs\/view)|v)\/(html5embed.action\?(code=|(type=0&code=)))?(\w+)/,
method: 'loadTudou',
index: 8
}

@@ -307,2 +320,10 @@ ]

Parser.prototype.loadTudou = function (cb, id) {
var self = this
this.load(cb, function (Cb) {
self.requestTudou(cb, id)
}, 'todou_' + id)
}
Parser.prototype.requestYoutube = function (cb, id) {

@@ -935,2 +956,43 @@ var self = this

Parser.prototype.requestTudou = function (cb, id) {
var url = [
'http://api.tudou.com/v6/video/info',
'?app_key=' + this._config.tudou.key,
'&format=json&itemCodes=' + id
].join('')
request(url, function (err, res, body) {
if (err) {
return cb(err)
}
var result = JSON.parse(body)
if (result.error_code) {
return cb(result.error_info)
}
if (result.results.length === 0) {
return cb('video.not_found')
}
var data = result.results[0]
cb(null, {
id: data.itemCode,
url: data.playUrl,
name: data.title,
desc: data.description,
thumb_url: data.bigPicUrl,
duration: data.totalTime,
ctime: moment(data.pubDate + '000000+09:00', 'YYYY-MM-DDhhmmssZZ').format(),
ratings: {},
details: {
definition: '',
author: {
id: data.ownerId,
title: data.ownerNickname || data.ownerName
}
}
})
})
}
Parser.prototype.loadCache = function (cb, cacheId) {

@@ -937,0 +999,0 @@ this._client.hget(this._config.name, cacheId, function (err, res) {

5

package.json
{
"name": "video-parser",
"version": "1.8.4",
"version": "1.9.0",
"author": {

@@ -26,3 +26,4 @@ "name": "egg",

"daum",
"tvpot"
"tvpot",
"tudou"
],

@@ -29,0 +30,0 @@ "license": "MIT",

@@ -54,2 +54,5 @@ # video-parser

key: ''
},
tudou: {
key: ''
}

@@ -72,3 +75,4 @@ ttl: 3600 * 12 // 1 day

'http://rutube.ru/video/2a39043b2108428a150fa27376adbea2/',
'http://tvpot.daum.net/mypot/View.do?clipid=72583600&ownerid=mRlSExWR4-Q0'
'http://tvpot.daum.net/mypot/View.do?clipid=72583600&ownerid=mRlSExWR4-Q0',
'http://www.tudou.com/programs/view/uKg4c5O0YyQ/'
]

@@ -252,2 +256,22 @@

}
{
"id": "uKg4c5O0YyQ",
"url": "http://www.tudou.com/programs/view/uKg4c5O0YyQ/",
"name": "CHARIS首尔美妆之旅(9.21-25)预告片",
"desc": "韩国潮流美妆平台CHARIS首尔美妆之旅(9.21-25)预告片",
"thumb_url": "http://g4.tdimg.com/260146303/diy_w_1.jpg",
"duration": 12000,
"ctime": "2016-09-06T00:00:00+09:00",
"ratings": {},
"details": {
"definition": "",
"author": {
"id": 993028656,
"title": "CHARIS官方"
}
},
"provider": "tudou"
}
```

@@ -254,0 +278,0 @@

@@ -20,2 +20,5 @@ 'use strict'

},
tudou: {
key: '' // app_key
},
ttl: 1 // 3600 * 12 // 1 day

@@ -80,2 +83,7 @@ })

// 'http://tvpot.daum.net/mypot/View.do?clipid=72583600&ownerid=mRlSExWR4-Q0'
// todou
// 'http://www.tudou.com/programs/view/uKg4c5O0YyQ/'
// 'http://www.tudou.com/v/hCgJVRch33w/&rpid=993090858&resourceId=993090858_04_05_99/v.swf'
// 'http://www.tudou.com/v/hCgJVRch33w/&bid=05&rpid=993090858&resourceId=993090858_05_05_99/v.swf'
]

@@ -82,0 +90,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc