浏览代码

[extractor/common] Add _form_hidden_inputs

Sergey M․ 10 年之前
父节点
当前提交
cf61d96df0
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      youtube_dl/extractor/common.py

+ 6 - 0
youtube_dl/extractor/common.py

@@ -718,6 +718,12 @@ class InfoExtractor(object):
                 ''', html)
         ])
 
+    def _form_hidden_inputs(self, form_id, html):
+        form = self._search_regex(
+            r'(?s)<form[^>]+?id=(["\'])%s\1[^>]*>(?P<form>.+?)</form>' % form_id,
+            html, '%s form' % form_id, group='form')
+        return self._hidden_inputs(form)
+
     def _sort_formats(self, formats, field_preference=None):
         if not formats:
             raise ExtractorError('No video formats found')