Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h1>Fetch public photos from Instagram without the API</h1>

<div id="instagram-photos" class="instagram-photos"></div>

<p style="text-align:center">Read more: <a href="" target="_blank" rel="noopener noreferrer">How to fetch your public photos from Instagram without the API</a></p>


                html, body {
  background: #333;
  color: #fff;
  font-size: 16px;
  line-height: 20px;
body {
  margin: 20px;

img {
  height: auto;
  max-width: 100%;

h1 {
  line-height: 1.2;
  margin-bottom: 35px;
  text-align: center;

.instagram-photos {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px 16px;

.instagram-photo {
  border: 4px solid #fff;
  box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1);
  flex: 1 0 auto;
  margin: 8px;
  position: relative;
  width: calc(100% / 2 - (8px * 2));
  @media only screen and (min-width: 768px) {
    width: calc(100% / 4 - (8px * 2));
  &:hover {
    &::after {
      background: rgba(0, 0, 0, 0.5);
      bottom: 0;
      content: "";
      display: block;
      left: 0;
      position: absolute;
      right: 0;
      top: 0;



                const instagramRegExp = new RegExp(/<script type="text\/javascript">window\._sharedData = (.*);<\/script>/)

const fetchInstagramPhotos = async (accountUrl) => {
  const response = await axios.get(accountUrl)
  const json = JSON.parse([1])
  const edges = json.entry_data.ProfilePage[0].graphql.user.edge_owner_to_timeline_media.edges.splice(0, 12)
  return{ node }) => ({
      url: `${node.shortcode}/`,
      thumbnailUrl: node.thumbnail_src,
      displayUrl: node.display_url,
      caption: node.edge_media_to_caption.edges[0].node.text

(async () => {
  try {
    const photos = await fetchInstagramPhotos('')
    const container = document.getElementById('instagram-photos')
    photos.forEach(el => {
      const a = document.createElement('a')
      const img = document.createElement('img')

      a.setAttribute('href', el.url)
      a.setAttribute('target', '_blank')
      a.setAttribute('rel', 'noopener noreferrer')

      img.setAttribute('src', el.thumbnailUrl)
      img.setAttribute('alt', el.caption)
  } catch (e) {
    console.error('Fetching Instagram photos failed', e)