Debian Codegraph @

components/extension/youtube/freac.extension.youtube/videosite_youtube.xml

raw symbols SCIP
1 <VideoSite>
2 <name>YouTube</name>
3 <version>1.0</version>
4 <decoders>
5 <decoder>ffmpeg-webm_audio-dec</decoder>
6 </decoders>
7
8 <script type="text/javascript">
9 <![CDATA[
10 function canHandleURL(URL) {
11 if (URL.toLowerCase().match(/https?:\/\/www.youtube.com\/watch\?v=.*/)) return true;
12 else return false;
13 }
14
15 function getVideoURL(html) {
16 var streamMap = (html.match(/"url_encoded_fmt_stream_map": "(.*?)"/), RegExp.$1.split(","));
17
18 for (var i = 0; i < streamMap.length; i++) {
19 if (streamMap[i].match(/type=video%2Fwebm/)) {
20 var url = (streamMap[i].match(/url=(.*?)(?:\\u0026.*)?$/), RegExp.$1);
21 var sig = (streamMap[i].match(/sig=(.*?)(?:\\u0026.*)?$/), RegExp.$1);
22
23 return "" + unescape(unescape(url)) + "&signature=" + sig;
24 }
25 }
26 }
27
28 function queryMetadata(html) {
29 var metadata = new Metadata();
30
31 metadata.title = (html.match(/<meta name="title" content="(.*?)">/) ? RegExp.$1 : null);
32 metadata.description = (html.match(/<p id="eow-description"\s*>((?:.|\n|\r)*?)<\/p>/) ? RegExp.$1 : null);
33
34 metadata.thumbnail = (html.match(/<meta property="og:image" content="(.*?)"\s*\/?>/) ? RegExp.$1 : null);
35
36 metadata.uploader = (html.match(/<a (?:.|\n|\r)*?class=".*?yt-user-name.*?"(?:.|\n|\r)*?>\s*(.*?)\s*<\/a>/) ? RegExp.$1 : null);
37
38 return metadata;
39 }
40 ]]>
41 </script>
42 </VideoSite>