Skip to content

Commit

Permalink
Fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacopo Jannone committed Sep 23, 2020
1 parent 995c44c commit 8004229
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
16 changes: 16 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.fetchJson) {
fetch(request.fetchJson)
.then(response => response.json())
.then(response => sendResponse(response));
return true;
}
if (request.fetchText) {
fetch(request.fetchText)
.then(response => response.text())
.then(response => sendResponse(response));
return true;
}
}
)
27 changes: 11 additions & 16 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,28 @@ var observer = new MutationObserver(function(mutations) {
let subdomain = match[1];
let sitename = match[2];
let recording_id = match[3];;
fetch(`https://${subdomain}.webex.com/webappng/api/v1/recordings/${recording_id}/stream?siteurl=${sitename}`)
.then(response => response.json())
.then(data => {
chrome.runtime.sendMessage(
{fetchJson: `https://${subdomain}.webex.com/webappng/api/v1/recordings/${recording_id}/stream?siteurl=${sitename}`},
function(data) {
let host = data["mp4StreamOption"]["host"];
let recording_dir = data["mp4StreamOption"]["recordingDir"];
let timestamp = data["mp4StreamOption"]["timestamp"];
let token = data["mp4StreamOption"]["token"];
let xml_name = data["mp4StreamOption"]["xmlName"];
let playback_option = data["mp4StreamOption"]["playbackOption"];
let meeting_name = data["recordName"];
fetch(`${host}/apis/html5-pipeline.do?recordingDir=${recording_dir}&timestamp=${timestamp}&token=${token}&xmlName=${xml_name}&isMobileOrTablet=false&ext=${playback_option}`)
.then(response => response.text())
.then(text => (new window.DOMParser()).parseFromString(text, "text/xml"))
.then(data => {
chrome.runtime.sendMessage(
{fetchText: `${host}/apis/html5-pipeline.do?recordingDir=${recording_dir}&timestamp=${timestamp}&token=${token}&xmlName=${xml_name}&isMobileOrTablet=false&ext=${playback_option}`},
function(text) {
let data = (new window.DOMParser()).parseFromString(text, "text/xml");
let filename = data.getElementsByTagName("Sequence")[0].textContent;
let mp4Url = `${host}/apis/download.do?recordingDir=${recording_dir}&timestamp=${timestamp}&token=${token}&fileName=${filename}`;
i.addEventListener("click", function() {
window.location = mp4Url;
})
})
.catch(exception => {
console.log("Error")
});
})
.catch(exception => {
console.log("Error")
});
}
)
}
)
}
});

Expand Down
5 changes: 4 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
"name": "WebXDownloader",
"manifest_version": 2,
"version": "1.1",
"version": "1.1.1",
"description": "Extracts the HLS stream of Webex meeting recordings",
"browser_action": {
"default_icon": "icon.png",
Expand All @@ -16,6 +16,9 @@
"matches": ["*://*.webex.com/*"],
"run_at": "document_end"
}],
"background": {
"scripts": ["background.js"]
},
"homepage_url": "https://github.com/jacopo-j/WebXDownloader",
"permissions": [
"tabs",
Expand Down
1 change: 1 addition & 0 deletions src/popup.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<head>
<meta charset="utf-8"/>
<style>
body {
width: 20em;
Expand Down

0 comments on commit 8004229

Please sign in to comment.