次のステートメントを使用して、Web ページのタイトルを取得しようとしています。
titl1 = re.findall(r'<title>(.*?)</title>',the_webpage)
それを使用すると、 が得られ['random webpage example1']
ます。引用符と括弧を削除するにはどうすればよいですか?
また、これを使用して、1 時間ごとに変更される一連のリンクを取得しようとしています (これがワイルドカードが必要な理由です) links = re.findall(r'(file=(.*?).mp3)',the_webpage)
。
私は得る
[('file=http://media.kickstatic.com/kickapps/images/3380/audios/944521.mp3',
'http://media.kickstatic.com/kickapps/images/3380/audios/944521'),
('file=http://media.kickstatic.com/kickapps/images/3380/audios/944521.mp3',
'http://media.kickstatic.com/kickapps/images/3380/audios/944521'),
('file=http://media.kickstatic.com/kickapps/images/3380/audios/944521.mp3',
'http://media.kickstatic.com/kickapps/images/3380/audios/944521')]
なしでmp3リンクを取得するにはどうすればよいfile=
ですか?
また、mp3 ファイルをダウンロードし、それらに Web サイトのタイトルを追加して、表示されるようにしたいと考えています。
random webpage example1.mp3
どうすればいいですか?私はまだPythonと正規表現を学んでいますが、これはちょっと困惑しています。