質問編集履歴

1

ソースコード表記できていなかったので修正

2022/08/06 13:59

投稿

gyonisokkusu
gyonisokkusu

スコア1

test CHANGED
File without changes
test CHANGED
@@ -14,23 +14,25 @@
14
14
 
15
15
  ### 該当のソースコード
16
16
 
17
+ ```
18
+ // RSSの読み込み
19
+ let xml = UrlFetchApp.fetch('https://www.youtube.com/feeds/videos.xml?user=youtubejapan').getContentText()
20
+ let document = XmlService.parse(xml)
21
+ let root = document.getRootElement()
22
+ let atom = XmlService.getNamespace('http://www.w3.org/2005/Atom')
23
+ let media = XmlService.getNamespace('media','http://search.yahoo.com/mrss');
24
+ let entries = root.getChildren('entry', atom)
17
25
 
18
- // RSSの読み込み
26
+ // RSSから取得
19
- let xml = UrlFetchApp.fetch('https://www.youtube.com/feeds/videos.xml?user=youtubejapan').getContentText()
20
- let document = XmlService.parse(xml)
27
+ for (var entry of entries) {
21
- let root = document.getRootElement()
22
- let atom = XmlService.getNamespace('http://www.w3.org/2005/Atom')
23
- let media = XmlService.getNamespace('media','http://search.yahoo.com/mrss');
24
- let entries = root.getChildren('entry', atom)
25
28
 
26
- // RSSから取得
27
- for (var entry of entries) {
28
-
29
- let title = entry.getChild('title', atom).getText()
29
+ let title = entry.getChild('title', atom).getText()
30
- let thumbnail = entry.getChild('group',media).getChild('thumbnail',media).getAttribute('url').getValue()
30
+ let thumbnail = entry.getChild('group',media).getChild('thumbnail',media).getAttribute('url').getValue()
31
-
31
+
32
- console.log(title );
32
+ console.log(title );
33
- console.log(thumbnail );
33
+ console.log(thumbnail);
34
- }
34
+ }
35
+ ```
35
36
 
36
37
 
38
+