Changeset f79fb4ec103b471e958ec1756d03cdde0e35bad1
- Timestamp:
- 02/21/08 02:47:15
(5 months ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1203558435 +0000
- git-parent:
[f03c892c22462ce8261937e0fe16739dc1b8ace9]
- git-author:
- Rafaël Carré <funman@videolan.org> 1203558435 +0000
- Message:
fix dailymotion parser, choosing VP6 as the default of the multiple streams available
note that a prebuilt table of preferred codecs, or even user interaction would be better
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf3c1693 |
rf79fb4e |
|
| 35 | 35 | line = vlc.readline() |
|---|
| 36 | 36 | if not line then break end |
|---|
| 37 | | if string.match( line, "param name=\"flashvars\" value=\".*url=http" ) |
|---|
| | 37 | if string.match( line, "param name=\"flashvars\" value=\".*video=" ) |
|---|
| 38 | 38 | then |
|---|
| 39 | | path = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*url=(http[^&]*).*$", "%1" ) ) |
|---|
| | 39 | arturl = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*preview=([^&]*).*$", "%1" ) ) |
|---|
| | 40 | videos = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*video=([^&]*).*$", "%1" ) ) |
|---|
| | 41 | --[[ we get a list of different streams available, at various codecs |
|---|
| | 42 | and resolutions: |
|---|
| | 43 | /A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264 |
|---|
| | 44 | Not everybody can decode HD, not everybody has a 80x60 screen, |
|---|
| | 45 | H264/MP4 is buggy , so i choose VP6 |
|---|
| | 46 | |
|---|
| | 47 | Ideally, VLC would propose the different streams available, codecs |
|---|
| | 48 | and resolutions (the resolutions are part of the URL) |
|---|
| | 49 | ]] |
|---|
| | 50 | for n in string.gmatch(videos, "[^|]+") do |
|---|
| | 51 | i = string.find(n, "@@") |
|---|
| | 52 | if i then |
|---|
| | 53 | video = string.sub( n, 0, i - 1) |
|---|
| | 54 | codec = string.sub( n, i + 2 ) |
|---|
| | 55 | if video and codec and string.match(codec, "vp6") then |
|---|
| | 56 | path = "http://dailymotion.com" .. video |
|---|
| | 57 | break |
|---|
| | 58 | end |
|---|
| | 59 | end |
|---|
| | 60 | end |
|---|
| 40 | 61 | end |
|---|
| 41 | | --[[ if string.match( line, "<title>" ) |
|---|
| 42 | | then |
|---|
| 43 | | title = vlc.decode_uri( string.gsub( line, "^.*<title>([^<]*).*$", "%1" ) ) |
|---|
| 44 | | end ]] |
|---|
| 45 | 62 | if string.match( line, "<meta name=\"description\"" ) |
|---|
| 46 | 63 | then |
|---|
| … | … | |
| 48 | 65 | description = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ .* %w+ %w+ %w+ %w+ Videos\. ([^\"]*)\".*$", "%1" ) ) |
|---|
| 49 | 66 | end |
|---|
| 50 | | if string.match( line, "\\\"videoPreview\\\"" ) |
|---|
| 51 | | then |
|---|
| 52 | | arturl = string.gsub( line, "^.*\\\"videoPreview\\\":\\\"([^\"]*).*$", "%1" ) |
|---|
| 53 | | arturl = string.gsub( arturl, "\\", "" ) |
|---|
| 54 | | end |
|---|
| 55 | 67 | if path and name and description and arturl then break end |
|---|
| 56 | 68 | end |
|---|