beautifulsoupによって取得したサイトのタイトルをテキストに書き込みたいのですが、[U+200E]と書き込まれます。調べたら空白が原因と書かれていたので、空白を削除するコードを追加したのですが、それでも[U+200E]と書き込まれます。どなたか原因がわかる方、何卒宜しくお願い致します。
import requests
from bs4 import BeautifulSoup
# 対象のURL
url = "https://apps.apple.com/jp/app/パズル-ドラゴンズ/id493470467"
try:
# リクエストを送信してHTMLを取得
res = requests.get(url)
# BeautifulSoupオブジェクトを作成
soup = BeautifulSoup(res.content, "html.parser")
# titleタグを取得
title_tags = soup.title
tag_obj = title_tags.string
tag_obj = tag_obj.strip()
print(tag_obj, end='*\n')
with open("all.text",'a',encoding="utf-8") as file:
file.write('\ntitle:' + tag_obj)
except Exception:
word = "取得できませんでした"
with open("all.text",'a',encoding="utf-8") as file:
file.write('\ntitle:' + word)
all.text
title:[U+200E]「パズル&ドラゴンズ」をApp Storeで
tag_obj = tag_obj.strip(' \t\r\n\u200e')