mirror of
https://github.com/instaloader/instaloader.git
synced 2024-08-18 04:39:39 +02:00
Add unicode normalization of captions (#1453)
This commit is contained in:
parent
fdcf2e1367
commit
463ada519e
@ -6,6 +6,7 @@ from collections import namedtuple
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union
|
||||
from unicodedata import normalize
|
||||
|
||||
from . import __version__
|
||||
from .exceptions import *
|
||||
@ -322,9 +323,9 @@ class Post:
|
||||
def caption(self) -> Optional[str]:
|
||||
"""Caption."""
|
||||
if "edge_media_to_caption" in self._node and self._node["edge_media_to_caption"]["edges"]:
|
||||
return self._node["edge_media_to_caption"]["edges"][0]["node"]["text"]
|
||||
return normalize("NFC", self._node["edge_media_to_caption"]["edges"][0]["node"]["text"])
|
||||
elif "caption" in self._node:
|
||||
return self._node["caption"]
|
||||
return normalize("NFC", self._node["caption"])
|
||||
return None
|
||||
|
||||
@property
|
||||
|
Loading…
Reference in New Issue
Block a user