fix youtube website changes
This commit is contained in:
parent
a0f276226a
commit
dfd4c8321c
1 changed files with 4 additions and 9 deletions
|
|
@ -18,7 +18,7 @@
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
import urllib
|
from urlparse import parse_qsl
|
||||||
|
|
||||||
from weboob.capabilities.base import UserError
|
from weboob.capabilities.base import UserError
|
||||||
from weboob.tools.browser import BasePage, BrokenPageError, BrowserIncorrectPassword
|
from weboob.tools.browser import BasePage, BrokenPageError, BrowserIncorrectPassword
|
||||||
|
|
@ -112,14 +112,9 @@ class VideoPage(BaseYoutubePage):
|
||||||
sub = text[pos+len(pattern):pos+text[pos:].find('\n')].rstrip(';')
|
sub = text[pos+len(pattern):pos+text[pos:].find('\n')].rstrip(';')
|
||||||
a = json.loads(sub)
|
a = json.loads(sub)
|
||||||
|
|
||||||
for part in a['args']['url_encoded_fmt_stream_map'].split('&'):
|
for part in a['args']['url_encoded_fmt_stream_map'].split(','):
|
||||||
key, value = part.split('=', 1)
|
args = dict(parse_qsl(part))
|
||||||
if key != 'itag' or not 'url' in value:
|
formats[int(args['itag'])] = args['url'] + '&signature=' + args['sig']
|
||||||
continue
|
|
||||||
|
|
||||||
value = urllib.unquote(value)
|
|
||||||
fmt, url = value.split(',url=')
|
|
||||||
formats[int(fmt)] = url
|
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue