-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f88c28f
Showing
6 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
var firstHref = $("a[href^='http']").eq(0).attr("href"); | ||
var source = document.documentElement.innerHTML; | ||
var startIndex = 0, endIndex; | ||
var allLinks = []; | ||
|
||
while (true) { | ||
startIndex = source.indexOf('<a id="aiPodcast', startIndex); | ||
if (startIndex == -1) { | ||
break; | ||
} | ||
endIndex = source.indexOf("</b>", startIndex); | ||
if (endIndex < startIndex) { | ||
break; | ||
} | ||
endIndex += 4; | ||
var content = source.substring(startIndex, endIndex); | ||
|
||
//parse link | ||
var linkStartIndex = content.indexOf("http"); | ||
if (linkStartIndex == -1) { | ||
break; | ||
} | ||
var linkEndIndex = content.indexOf(".mp4"); | ||
if (linkEndIndex == -1) { | ||
linkEndIndex = content.indexOf(".mp3"); | ||
} | ||
if (linkEndIndex == -1 || linkEndIndex < linkStartIndex) { | ||
break; | ||
} | ||
linkEndIndex += 4; | ||
var parsedLink = content.substring(linkStartIndex, linkEndIndex); | ||
parsedLink = parsedLink.replace("/StreamInBrowser/", "/Stream/"); | ||
parsedLink = parsedLink.replace(".mp3", ".mp4"); | ||
|
||
//parse title | ||
var titleStartIndex = content.indexOf("<b>"); | ||
titleStartIndex += 3; | ||
var titleEndIndex = content.indexOf("</b>"); | ||
|
||
var parsedTitle = content.substring(titleStartIndex, titleEndIndex); | ||
|
||
var media = { | ||
title: parsedTitle, | ||
link: parsedLink | ||
} | ||
|
||
allLinks.push(media); | ||
|
||
startIndex = endIndex; | ||
} | ||
|
||
chrome.storage.local.set({'videoLinks': allLinks}, function() { | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"manifest_version": 2, | ||
|
||
"name": "IVLE Downloader", | ||
"description": "This extension will download videos", | ||
"version": "1.0", | ||
|
||
"browser_action": { | ||
"default_icon": "icon.png", | ||
"default_popup": "popup.html" | ||
}, | ||
|
||
"permissions": [ | ||
"activeTab", "storage" | ||
], | ||
|
||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"js": ["jquery-3.2.1.min.js", "content.js"] | ||
} | ||
] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>IVLE downloader</title> | ||
<meta name="description" content="The HTML5 Herald"> | ||
<meta name="author" content="SitePoint"> | ||
|
||
|
||
<script src="popup.js"></script> | ||
<!--[if lt IE 9]> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script> | ||
<![endif]--> | ||
</head> | ||
|
||
<body> | ||
<h2>Usage:</h2> | ||
<p style = "width: 300px"> | ||
1. Load a webcast normally to authenticate yourself. Then close the window.<br> | ||
2. Go back to webcast video list and refresh.<br> | ||
3. Open this and links should appear here.<br> | ||
<br> | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var links = []; | ||
chrome.storage.local.get('videoLinks', function(res) { | ||
for (var i = 0, len = res.videoLinks.length; i < len; i++) { | ||
var title = res.videoLinks[i].title; | ||
var link = res.videoLinks[i].link; | ||
links.push(res.videoLinks[i]); | ||
document.body.innerHTML += "<a href ='" + link + "' download='" + title + "'>" + title + "</a><br /><br />"; | ||
} | ||
}); |