fix compat_urllib_request for python2.7
authorsprhawk <465558+sprhawk@users.noreply.github.com>
Tue, 26 Dec 2017 08:46:01 +0000 (16:46 +0800)
committersprhawk <465558+sprhawk@users.noreply.github.com>
Tue, 26 Dec 2017 08:46:01 +0000 (16:46 +0800)
youtube_dl/extractor/weibo.py

index b4ac7b9fa7b38491e6c45fdeec925ff61f0c1183..f8a5ee71c9902d51409fb5f577b467bb5dca6665 100644 (file)
@@ -9,7 +9,7 @@ import re
 
 from ..compat import (
     compat_urllib_parse_urlencode as urlencode,
-    compat_urllib_request as Request,
+    compat_urllib_request as request,
     compat_urlparse as parse,
 )
 from ..utils import (
@@ -52,11 +52,10 @@ class WeiboIE(InfoExtractor):
             'Referer': visitor_url,
         }
 
-        r_genvisitor = Request(
+        r_genvisitor = request.Request(
             'https://passport.weibo.com/visitor/genvisitor',
             data=data,
             headers=headers,
-            method='POST'
         )
         webpage, urlh = self._download_webpage_handle(r_genvisitor, video_id, note="gen visitor")
 
@@ -85,7 +84,7 @@ class WeiboIE(InfoExtractor):
         # TODO more code goes here, for example ...
         title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
 
-        video_sources_text = self._search_regex("video-sources=\\\\\"(.+?)\"", webpage, 'video_sources')
+        video_sources_text = self._search_regex(r'video-sources=\\\"(.+?)\"', webpage, 'video_sources')
 
         video_formats = parse.parse_qs(video_sources_text)