Closed
Bug 381793
Opened 17 years ago
Closed 17 years ago
Joey Addon: find media (video, audio) files by examining HTTP requests
Categories
(Mozilla Labs :: Joey, enhancement)
Mozilla Labs
Joey
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: pawel.knapik, Assigned: dougt)
Details
Attachments
(1 file, 1 obsolete file)
5.43 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty) Build Identifier: Joey Addon : sniffing media files Joey uses site-specific "hacks" to detect media content files' URIs. My suggestion is to add a kind of sniffer that examines every request on a page and determines if it is media file by http headers or file extension. Here's a piece of code that worked well with youtube, last.fm and a few other sites: var g_joey_mediaContentTypes = ['flv','mov','wmv','avi','mpeg','mp3','wav']; var httpscanner = { observe: function(subject,topic,data){ var response=subject.QueryInterface(Components.interfaces.nsIHttpChannel); var contentType=response.getResponseHeader('Content-Type'); function testContentType(types){ var isMediaFile = false; for(var i=types.length;i>=0;i--){ if(contentType.indexOf(types[i])>-1 || mediaLocation.indexOf('.'+types[i])>-1) isMediaFile = true; } return isMediaFile; } if(contentType.indexOf('video')>-1 || contentType.indexOf('audio')>-1 || contentType.indexOf('octet')>-1){ var mediaLocation=subject.QueryInterface(Components.interfaces.nsIChannel).URI; mediaLocation=mediaLocation.prePath+mediaLocation.path; if(testContentType(g_joey_mediaContentTypes)){ joeyDumpToConsole("media content found: "+ mediaLocation); g_joey_media_url = mediaLocation; } } } } var observerService = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); observerService.addObserver(httpscanner,"http-on-examine-response",false); Reproducible: Always
Reporter | ||
Updated•17 years ago
|
Summary: find media (video, audio) files by examining HTTP requests → Joey Addon: find media (video, audio) files by examining HTTP requests
Assignee | ||
Comment 1•17 years ago
|
||
this is great stuff. can you get a patch together for the joey addon?
Reporter | ||
Comment 2•17 years ago
|
||
Assignee | ||
Comment 3•17 years ago
|
||
hi pawel, i applied this patch, and thing just didn't wokr -- going to youtube didn't add a menu item in the joey button at the bottom of the browser. should it?
Reporter | ||
Comment 4•17 years ago
|
||
hey Doug, there's an updated patch - now the "Joey! media on page" button shows up when media file is found.
Attachment #265955 -
Attachment is obsolete: true
Assignee | ||
Comment 5•17 years ago
|
||
this is great. I think we are going to have to figure out sites that lie about their content type (for example, myspace videos seam to be broken). Thanks pawel. r4133
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•