1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# new version
Index: xvst-2.5/resources/services/yahoovideo/yahoovideo.js
===================================================================
--- xvst-2.5.orig/resources/services/yahoovideo/yahoovideo.js 2013-02-25 19:37:11.000000000 +0100
+++ xvst-2.5/resources/services/yahoovideo/yahoovideo.js 2013-09-09 18:48:45.076024563 +0200
@@ -25,11 +25,11 @@
function RegistVideoService()
{
- this.version = "1.0.0";
+ this.version = "1.1.0";
this.minVersion = "2.0.0a";
- this.author = "Xesc & Technology 2009";
- this.website = "http://video.yahoo.com/";
- this.ID = "video.yahoo.com";
+ this.author = "anon";
+ this.website = "http://screen.yahoo.com/";
+ this.ID = "screen.yahoo.com";
this.caption = "Yahoo Video";
this.adultContent = false;
this.musicSite = false;
@@ -37,30 +37,46 @@
function getVideoInformation(url)
{
- const URL_GET_XML = "http://cosmos.bcst.yahoo.com/up/yep/process/getPlaylistFOP.php?node_id=%1&tech=flash&mode=playlist&bitrate=300&null&rd=video.yahoo.com&tk=null";
+ var url_get_json ="http://video.query.yahoo.com/v1/public/yql?q=SELECT streams FROM yahoo.media.video.streams WHERE id=\"%1\" AND plrs=\"\" AND protocol=\"http\" AND region=\"%2\";&env=prod&format=json";
// init result
var result = new VideoDefinition();
// download webpage
var http = new Http();
var html = http.downloadWebpage(url);
// get video title
- result.title = copyBetween(html, "<meta name=\"title\" content=\"", "\"");
- // if we didn't get a title, try to get the channel video title
- if (result.title == "")
- result.title = copyBetween(html, "<h2 id=\"nvi_title\">", "</h2>");
+ var title = copyBetween(html, "<title>", "</title>");
+ //if we have the ?format=embed parameter added, the | is missing
+ if (title.toString().indexOf(" |") != -1)
+ title = copyBetween(title, "", " |");
+ result.title = title;
// get the node_id
- var node_id = copyBetween(html, "so.addVariable(\"id\", \"", "\"");
- // download xml
- var xml = http.downloadWebpage(strFormat(URL_GET_XML, node_id));
+ var node_id = copyBetween(html, "\"id\":\"", "\"");
+ // get the region
+ var region = copyBetween(html, "region: \'", "\'");
+ // download json
+ var jsonstr = http.downloadWebpage(strFormat(url_get_json, node_id, region));
+ var json = JSON.parse(jsonstr);
+ var streams = json.query.results.mediaObj[0].streams;
+ var streamindex = streams.length - 1; //the streams are sorted by quality. highest is last.
// get video host and path
- var host = copyBetween(xml, "<STREAM APP=\"", "\"");
- var path = copyBetween(xml, "FULLPATH=\"", "\"");
+ var host = streams[streamindex].host; //copyBetween(json, "\"host\":\"", "\"");
+ var path = streams[streamindex].path; //copyBetween(json, "\"path\":\"", "\"")
// set video URL
- result.URL = strReplace(host + path, "&", "&");
+ result.URL = host + path; //take the video with highest quality
+ result.extension = extensionFromVideoType(streams[streamindex].mime_type);
// return the video information
return result;
}
+function extensionFromVideoType(vtype)
+{
+ if (vtype == "video/x-flv") return ".flv";
+ if (vtype == "video/mp4") return ".mp4";
+ if (vtype == "video/webm") return ".webm";
+ // default extension
+ return ".flv";
+}
+
function getVideoServiceIcon()
{
return new Array(
@@ -72,4 +88,4 @@
0x30,0xec,0x01,0xc4,0xcb,0x70,0x47,0x10,0x2e,0x33,0x20,0x5b,0xb2,0xbd,0x58,0x9c,
0xfa,0x5b,0x0d,0x9a,0xe5,0x10,0xb3,0x3f,0x33,0x07,0xa6,0xb3,0x7e,0x82,0xcd,0x2f,
0x11,0x53,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82);
-}
+}
\ No newline at end of file
|