projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fc27ea9
)
[instagram] Extract embed videos (#8817)
author
Yen Chi Hsuan
<yan12125@gmail.com>
Thu, 24 Mar 2016 08:29:33 +0000
(16:29 +0800)
committer
Yen Chi Hsuan
<yan12125@gmail.com>
Thu, 24 Mar 2016 08:29:33 +0000
(16:29 +0800)
youtube_dl/extractor/instagram.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/instagram.py
b/youtube_dl/extractor/instagram.py
index ed3e0711815bc36a6b8702c994087ae5827f5dab..e8b27b3794ef0623a9b64f5a876e887cc841c8c8 100644
(file)
--- a/
youtube_dl/extractor/instagram.py
+++ b/
youtube_dl/extractor/instagram.py
@@
-4,6
+4,7
@@
import re
from .common import InfoExtractor
from ..utils import (
from .common import InfoExtractor
from ..utils import (
+ get_element_by_attribute,
int_or_none,
limit_length,
)
int_or_none,
limit_length,
)
@@
-38,6
+39,18
@@
class InstagramIE(InfoExtractor):
'only_matching': True,
}]
'only_matching': True,
}]
+ @staticmethod
+ def _extract_embed_url(webpage):
+ blockquote_el = get_element_by_attribute(
+ 'class', 'instagram-media', webpage)
+ if blockquote_el is None:
+ return
+
+ mobj = re.search(
+ r'<a[^>]+href=([\'"])(?P<link>[^\'"]+)\1', blockquote_el)
+ if mobj:
+ return mobj.group('link')
+
def _real_extract(self, url):
video_id = self._match_id(url)
def _real_extract(self, url):
video_id = self._match_id(url)