Skip to content

Commit ef7ab3d

Browse files
committed
fixed #15
change Facebook video data structure
1 parent c775f22 commit ef7ab3d

File tree

6 files changed

+38
-113
lines changed

6 files changed

+38
-113
lines changed

.jshintrc

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

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.8.0
2+
3+
- Change facebook video data structure.
4+
15
# 1.7.1
26

37
- Add embed info to daum tvpot video.

README.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
[![version](https://img.shields.io/npm/v/video-parser.svg) ![download](https://img.shields.io/npm/dm/video-parser.svg)](https://www.npmjs.com/package/video-parser)
44

55
Extract video information by parsing the url.
6-
Important: If you find compatibility issues, check the bug reporting page.
6+
7+
Important
8+
* If you find compatibility issues, check the bug reporting page.
9+
* Change facebook video data stucture at v1.8.0 (see also [#15](/../../issues/15))
710

811
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
912

1013
### Support provider
1114

1215
* [youtube](https://www.youtube.com/)
1316
* [vimeo](https://vimeo.com/)
14-
* facebook video: The videos can be registered to the pages only. Other video registered individuals does not provide the metadata from api.
17+
* [facebook video](https://developers.facebook.com/docs/graph-api/reference/video): The videos can be registered to the pages only. Other video registered individuals does not provide the metadata from api.
1518
* [youku](http://www.youku.com/)
1619
* [dailymotion](http://www.dailymotion.com/kr)
1720
* [naver tvcast](http://tvcast.naver.com) - It can be stopped unexpectedly due to parse the data from the site.
@@ -59,12 +62,9 @@ parser.on('error', function(err) {
5962

6063
var url = [
6164
'https://www.youtube.com/watch?v=-RWl24TUW6g',
62-
'https://youtu.be/-RWl24TUW6g',
6365
'https://vimeo.com/60788712',
64-
'https://www.facebook.com/video/embed?video_id=368508506585276',
65-
'https://www.facebook.com/1399785403664362/videos/1428693740773528/',
66+
'https://www.facebook.com/snackk100/videos/vb.713427005470569/765726663573936/?type=2&theater',
6667
'http://v.youku.com/v_show/id_XMTMwMDYxMjQxMg==_ev_1.html?from=y1.3-idx-uhome-1519-20887.205805-205902.1-1',
67-
'http://dai.ly/x2jvvep',
6868
'http://www.dailymotion.com/video/x2jvvep',
6969
'http://tvcast.naver.com/v/584455',
7070
'http://rutube.ru/video/2a39043b2108428a150fa27376adbea2/',
@@ -123,21 +123,23 @@ for (var i = 0; i < url.length; i++) {
123123
}
124124

125125
{
126-
"id":"1428693740773528",
127-
"url":"https://fbcdn-video-l-a.akamaihd.net/hvideo-ak-xpa1/v/t42.1790-2/11223180_1428693800773522_105807484_n.mp4?efg=eyJxZSI6ImZiY2RuX3ZpZGVvX3JhdGVsaW1pdF9yb2xsb3V0Mix2X3JvbGxvdXQiLCJybHIiOjU0NSwicmxhIjo1MTJ9&rl=545&vabr=303&oh=d5c0d0a36c5a75520758969db22cc2d2&oe=5556F7CA&__gda__=1431753137_8141cd5880d195db73c20e5b26f650ea",
128-
"name":"TOSQ",
129-
"desc":"삼둥이도 적다. 사둥이는 되야지\n책상과 의자세트도 직접 제작한듯ㅋㅋㅋ \n#baby #Laughing \n \n \n \n \n \n#귀요미 더보기 -> http://tosq.tv/pd/babies \n원본링크 https://www.youtube.com/watch?v=zZH0sNsaAz4",
130-
"thumb_url":"https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xtf1/v/t15.0-10/11189097_1428693840773518_1904978325_n.jpg?oh=b59e98b9153dff06337c96d0514b288c&oe=55C3F8AA&__gda__=1438973665_0aa297242e5a94ac16bdcd75312e3452",
131-
"duration":66,
132-
"ratings":null,
133-
"details":{
134-
"definition":"",
135-
"author":{
136-
"id":"1399785403664362",
137-
"title":"TOSQ"
138-
}
139-
},
140-
"provider":"facebook"
126+
"id": "765726663573936",
127+
"url": "https://www.facebook.com/713427005470569/videos/765726663573936",
128+
"name": "스낵 - Snackk.tv",
129+
"desc": "애 엄마가 보면 기겁할 듯 ㅇ0ㅇ\n\n #첫눈 온 날 라이딩 영상보며 대리만족\n+귀여운 아기는 덤",
130+
"thumb_url": "https://scontent.xx.fbcdn.net/hvthumb-xap1/v/t15.0-10/s480x480/12105363_765755180237751_1022961937_n.jpg?oh=e7e102c2dce9fa6463b3ffc9cedff592&oe=56E72E65",
131+
"duration": 233,
132+
"ctime": "2015-11-26T14:58:17+09:00",
133+
"ratings": null,
134+
"details": {
135+
"definition": "",
136+
"author": {
137+
"id": "713427005470569",
138+
"title": "스낵 - Snackk.tv"
139+
},
140+
"source": "https://video.xx.fbcdn.net/hvideo-xpa1/v/t43.1792-2/12251290_1016430301743231_1083820292_n.mp4?efg=eyJybHIiOjI5OTQsInJsYSI6NDA5NiwidmVuY29kZV90YWciOiJzdmVfaGQifQ%3D%3D&rl=2994&vabr=1996&oh=31a605409c8bd8fd3f427793a7377b7b&oe=5659E9A0"
141+
},
142+
"provider": "facebook"
141143
}
142144

143145
{

lib/parser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ Parser.prototype.requestFacebook = function (cb, id) {
521521

522522
cb(err, {
523523
id: id,
524-
url: res.source,
524+
url: ['https://www.facebook.com/', res.from.id, '/videos/', id].join(''),
525525
name: res.from.name,
526526
desc: res.description,
527527
thumb_url: thumbnail.picture || res.picture,
@@ -533,7 +533,8 @@ Parser.prototype.requestFacebook = function (cb, id) {
533533
author: {
534534
id: res.from.id,
535535
title: res.from.name
536-
}
536+
},
537+
source: res.source
537538
}
538539
})
539540
}, 'facebook_meta_' + id, res.source)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "video-parser",
3-
"version": "1.7.1",
3+
"version": "1.8.0",
44
"author": {
55
"name": "egg",
66
"email": "i@egg.pe.kr"

test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ var url = [
3333
// 'https://youtu.be/-RWl24TUW6g',
3434
// 'https://www.youtube.com/watch?t=28&v=B4k8BiTd-_s',
3535
// 'https://vimeo.com/60788712',
36+
37+
// facebook
3638
// 'https://www.facebook.com/video/embed?video_id=368508506585276',
3739
// 'https://www.facebook.com/1399785403664362/videos/1428693740773528/',
3840
// 'https://www.facebook.com/snackk100/videos/754790044667598/?permPage=1',
39-
// 'https://www.facebook.com/insight.co.kr/videos/vb.374726359324617/907652546031993/?type=2&theater'
41+
// 'https://www.facebook.com/insight.co.kr/videos/vb.374726359324617/907652546031993/?type=2&theater',
4042
// 'https://www.facebook.com/Jrockradio/videos/vb.102198813200663/880536688700201/?type=2&theater',
41-
// 'https://www.facebook.com/ICMSChairman/videos/vb.595785693780145/1089273701098006/?type=2&theater'
43+
// 'https://www.facebook.com/ICMSChairman/videos/vb.595785693780145/1089273701098006/?type=2&theater',
44+
// 'https://www.facebook.com/huffpostkorea/videos/615775111903484/?permPage=1',
45+
// 'https://www.facebook.com/snackk100/videos/vb.713427005470569/765726663573936/?type=2&theater',
46+
4247
// 'http://v.youku.com/v_show/id_XMTMwMDYxMjQxMg==_ev_1.html?from=y1.3-idx-uhome-1519-20887.205805-205902.1-1',
4348
// 'http://v.youku.com/v_show/id_XMTI5NDcwNjQxNg==.html?f=23007024&from=y1.3-idx-uhome-1519-20887.205908-205909-205916.1-3',
4449
// 'http://v.youku.com/v_show/id_XMTMwMDgxNTY0NA==.html?f=25924643&ev=3',

0 commit comments

Comments
 (0)