Skip to content

Commit 40edffa

Browse files
committed
[ninegag] unscape title(ytdl-org#28201)
1 parent 9fc5eaf commit 40edffa

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

youtube_dl/extractor/ninegag.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from .common import InfoExtractor
44
from ..utils import (
5-
determine_ext,
65
ExtractorError,
6+
determine_ext,
77
int_or_none,
88
try_get,
9+
unescapeHTML,
910
url_or_none,
1011
)
1112

@@ -14,7 +15,7 @@ class NineGagIE(InfoExtractor):
1415
IE_NAME = '9gag'
1516
_VALID_URL = r'https?://(?:www\.)?9gag\.com/gag/(?P<id>[^/?&#]+)'
1617

17-
_TEST = {
18+
_TESTS = [{
1819
'url': 'https://9gag.com/gag/ae5Ag7B',
1920
'info_dict': {
2021
'id': 'ae5Ag7B',
@@ -29,7 +30,11 @@ class NineGagIE(InfoExtractor):
2930
'dislike_count': int,
3031
'comment_count': int,
3132
}
32-
}
33+
}, {
34+
# HTML escaped title
35+
'url': 'https://9gag.com/gag/av5nvyb',
36+
'only_matching': True,
37+
}]
3338

3439
def _real_extract(self, url):
3540
post_id = self._match_id(url)
@@ -43,7 +48,7 @@ def _real_extract(self, url):
4348
'The given url does not contain a video',
4449
expected=True)
4550

46-
title = post['title']
51+
title = unescapeHTML(post['title'])
4752

4853
duration = None
4954
formats = []

0 commit comments

Comments
 (0)