0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

rss2jsonがうまく動作しなくなったので、GoogleのBloggerから記事を取得するAPIの方法を利用しましたメモ

GoogleAPIのキーが必要なので、参考サイトを参照してAPIキー作成してます

IDやKEY,URLの設定

//0000000000000000000やAAAAAAAAAAAAAAA-AAAAAAAAAAAAAAAAAAAAAAAの箇所は自身のIDやKEYを入力
const BLOG_ID = '0000000000000000000',
  API_KEY = 'AAAAAAAAAAAAAAA-AAAAAAAAAAAAAAAAAAAAAAA',
  BLG_API_URL = `https://www.googleapis.com/blogger/v3/blogs/${BLOG_ID}/posts`,
  FEED_NEWS_URL = `${BLG_API_URL}?q=${'news'}&maxResults=${'2'}&key=${API_KEY}`,
  FEED_KNGE_URL = `${BLG_API_URL}?q=${'knowledge'}&maxResults=${'2'}&key=${API_KEY}`,

データ問い合わせ

async function getData(url = '') {
  const response = await fetch(url, {
    method: 'GET', // *GET, POST, PUT, DELETE, etc.
  });
  //console.log(response)
  return response.json();
}
 getData(FEED_NEWS_URL)
    .then((data) => {
      //console.log(data)
      data.items.forEach((item) => {
        console.log(item)
       });
    })

参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?